Opster

Command-line parsing speedster
Download

Opster Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Alexander Solovyov
  • Publisher web site:
  • http://hg.piranha.org.ua/

Opster Tags


Opster Description

Command-line parsing speedster Opster is a command line parser, intended to make writing command line applications easy and painless. The software uses built-in Python types (lists, dictionaries, etc) to define options, which makes configuration clear and concise. Additionally it contains possibility to handle subcommands (i.e. hg commit or svn update).Quick exampleThat's an example of an option definition:import sysfrom opster import command@command(usage='%name MESSAGE')def main(message, nonewline=('n', False, 'don't print a newline')): 'Simple echo program' sys.stdout.write(message) if not nonewline: sys.stdout.write(' ')if __name__ == '__main__': main()Running this program will print the help:echo.py MESSAGESimple echo programoptions: -n --nonewline don't print a newline -h --help show helpI think this mostly describes what's going on, except that I'd like to mention one interesting feature - if you are using long name for option, you can use only partial name, for example ./echo.py --nonew a is valid command line. This is also true for subcommands: read about that and everything else you'd like to know in documentation. Requirements: · Python What's New in This Release: · Now it's possible to call commands as regular function, where every non-supplied option will receive proper default (defined in option spec) · Globaloptions were simply dropped after parsing, fold them in regular options · Replace _ with - in command names, same as in options names · Respect empty strings as usage


Opster Related Software