version 2.0 2.0
authorAlexander Solovyov <alexander@solovyov.net>
Sun, 23 Jan 2011 18:37:08 +0100
changeset 163 a8a8ae1a3fbe
parent 162 e924a731e195
child 164 7d5e22ae5ccb
version 2.0
docs/changelog.rst
docs/overview.rst
opster.py
--- a/docs/changelog.rst	Sun Jan 23 18:34:31 2011 +0100
+++ b/docs/changelog.rst	Sun Jan 23 18:37:08 2011 +0100
@@ -1,6 +1,13 @@
 Changelog
 ---------
 
+2.0 (2010.01.23)
+~~~~~~~~~~~~~~~~
+
+ - fix help display when there is no __doc__ declared for function
+ - ``dict`` type :ref:`handling <opthandling>`
+ - ``.help()`` attribute for every function, printing help on call
+
 1.2 (2010.12.29)
 ~~~~~~~~~~~~~~~~
 
--- a/docs/overview.rst	Sun Jan 23 18:34:31 2011 +0100
+++ b/docs/overview.rst	Sun Jan 23 18:37:08 2011 +0100
@@ -25,6 +25,8 @@
 If a short name renders to False (for example, empty string), then it's not used
 at all. Long name is pretended to be available in any case.
 
+.. _opthandling:
+
 Options processing
 ^^^^^^^^^^^^^^^^^^
 
@@ -35,9 +37,11 @@
  - string: value is passed as is
  - list: value is appended to this list
  - dictionary: value is then assumed being in format ``key=value`` and is
-   then assigned to this dictionary
+   then assigned to this dictionary, `example`_
  - boolean/None: ``not default`` is passed and option takes no value
 
+.. _example: http://hg.piranha.org.ua/opster/file/default/tests/opster.t#l109
+
 Usage
 ^^^^^
 
@@ -185,6 +189,18 @@
       --exit  exit with supplied code (default: 0)
    -h --help  show help
 
+If you need to display help from inside your application, you can always use the
+fact that help-displaying function is attached to your function object, i.e.::
+
+  @command()
+  def something():
+      if some_consiquences:
+          something.help()
+
+See `example from tests`_.
+
+.. _example from tests: http://hg.piranha.org.ua/opster/file/default/tests/selfhelp.py
+
 
 Tips and tricks
 ---------------
--- a/opster.py	Sun Jan 23 18:34:31 2011 +0100
+++ b/opster.py	Sun Jan 23 18:37:08 2011 +0100
@@ -6,7 +6,7 @@
 from itertools import imap
 
 __all__ = ['command', 'dispatch']
-__version__ = '1.2'
+__version__ = '2.0'
 __author__ = 'Alexander Solovyov'
 __email__ = 'piranha@piranha.org.ua'