Dennis Malcorps <dennis.malco...@googlemail.com> added the comment:

Here is a patch that adds a 'write' action to argparse. Usage example:

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument("--license", action="write", message="This file\nis 
>>> licensed under \t GPL")
>>> parser.parse_args(['--license'])
This file
is licensed under        GPL

A linebreak will be added after the message. The Output can be redirected with 
the optional 'file=' argument (it defaults to sys.stdout) The parser will then 
exit. 

This is my first patch ever written, so don't be too harsh if it's utter 
garbage^^

----------
keywords: +patch
Added file: http://bugs.python.org/file18268/argparse.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9399>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to