Andy Mikhailenko
Andy Mikhailenko
### Background Argh follows Argparse's grouping of arguments into two bunches: - "Positional" = determined by position and required (possibly optional with `nargs` set to `?` or `*`) - "Optional"...
### Example program ```python #!/usr/bin/python from time import sleep import argh def main(): for i in range(3): sleep(1) yield f'line {i}' argh.dispatch_command(main) ``` ### Case A: ``` $ ./app.py 0...
http://docs.python.org/dev/library/argparse.html#argument-groups **Note**: This issue has been automatically migrated from Bitbucket Created by @neithere on 2012-12-23 02:43:49+00:00
### Observation ``` $ timetra find -a sleep -f 'foooooooooooooooooooooooooooooooooooooooooooo' | head foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooooooooooooo Traceback (most recent call last): File "/home/andy/src/timetra/bin/timetra", line...
Let's say we want to add a command to the parser with slightly different configuration: ``` python class Foo: def meth(self): pass foo = Foo() command = argh.named('another-name')(foo.meth) # WRONG!...
Typical case: ``` python class Controller: db = {1: 'foo', 2: 'bar'} def index(self): return self.db.keys() def detail(self, key): return self.db[key] c = Controller() # now parser.add_commands([c.index, c.detail]) # ideally...
@tiktuk has proposed to add the following projects to the list at http://packages.python.org/argh/index.html#similar-projects: - http://pypi.python.org/pypi/Baker/ - http://plumbum.readthedocs.org/en/latest/cli.html - http://docopt.org **Note**: This issue has been automatically migrated from Bitbucket Created by...
Building the complete ArgumentParser tree in complex apps (with namespaced commands i.e. subparsers) can take considerable time (as it imports just about everything from the sub-apps). A "lazy" parsing tree...
..like in Mercurial: ``` #!bash $ hg sta $ hg status ``` This doesn't seem to be available in argparse in any form. **Note**: This issue has been automatically migrated...
Currently "only" three levels are supported: prog, subparser and subsubparser. **Note**: This issue has been automatically migrated from Bitbucket Created by @neithere on 2010-11-13 00:34:12+00:00, last updated: 2012-12-18 15:34:21+00:00