README
author Alexander Solovyov <piranha@piranha.org.ua>
Mon, 13 Jul 2009 19:13:19 +0300
changeset 38 d64102e06c34
parent 36 0cb832d5f1a9
child 41 8f651939cab7
permissions -rw-r--r--
hint about adding option lists

.. -*- mode: rst -*-

=============
 Finaloption
=============

Finaloption 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``).

JFYI: name is derived from Die Krupps' song Final Option, featured in epigraph.

Quick example
-------------

That's simple example to show you example of an option definition::

  import sys
  from finaloption import command

  @command(usage='%name [-n] 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('\n')

  if __name__ == '__main__':
      main()

Running this program will print the help::

  echo.py [-n] MESSAGE

  Simple echo program

  options:

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

I think this mostly describes what's going to. To learn more, read
`documentation`_.

.. _documentation: http://hg.piranha.org.ua/finaloption/docs/