ade.args.Args(object)
class documentation
Part of ade.args
(View In Hierarchy)
Convenience class by Edwin A. Suominen for compact and sensible commandline argument parsing.
The code of this class, separate from the rest of the ade package and project, is dedicated to the public domain.
Usage: Construct an instance with a text description of your
application. Then call the instance for each option you want to add, with a
short letter (just a single letter) preceded by a single hyphen
("-"), a long option preceded by a pair of hyphens
("--"), a default value if the option isn't just
store_true
, and a text description of the option. There will
be a total of 3-4 arguments.
You will access the option value using the short letter value, which gives you 26 possibilities for options (52 if you use both upper and lowercase). If you need more than that, you may be overcomplicating your command line.
Call the instance with a text description as a single argument to allow for positional arguments. The arguments will be accessed from the instance as sequence items.
Call the instance with a callable to run it if the global module name is '__main__' (i.e., it's been called as a script) and the 'h' option (for help) is not set.
The instance will look exactly like an
argparse.ArgumentParser
object, all set up and ready to have
its attributes accessed.
Method | __init__ | Undocumented |
Method | __bool__ | Undocumented |
Method | addDefault | Undocumented |
Method | __iter__ | Undocumented |
Method | __len__ | Undocumented |
Method | __getitem__ | Undocumented |
Method | __getattr__ | Undocumented |
Method | __call__ | Undocumented |