author Alexander Solovyov <>
Sun, 19 Sep 2010 20:17:49 +0300
changeset 121 836bb50a8660
parent 75 2782b2406ba8
child 123 4d73a8af4bbf
permissions -rw-r--r--
Added tag 0.9.11 for changeset bf6908d12aae

.. -*- mode: rst -*-


Opster is a command line parser, intended to make writing command line
applications easy and painless. It 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 example

That's an example of an option definition::

  import sys
  from opster import command

  @command(usage='%name [-n] MESSAGE')
  def main(message,
           nonewline=('n', False, 'don\'t print a newline')):
      'Simple echo program'
      if not nonewline:

  if __name__ == '__main__':

Running this program will print the help:: [-n] MESSAGE

  Simple echo program


   -n --nonewline  don't print a newline
   -h --help       show help

I 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 ``./ --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`_.

.. _documentation: