--- a/README Sat Nov 27 20:48:16 2010 +0100
+++ b/README Mon Dec 06 23:42:07 2010 +0100
@@ -54,3 +54,11 @@
.. _documentation: http://hg.piranha.org.ua/opster/docs/
.. _see description: http://hg.piranha.org.ua/opster/docs/overview.html#options-processing
+
+Plans
+-----
+
+ - Better documentation
+ - (under consideration) ability to have few command collectors in a single
+ application (more than one dispatching entry point)
+
--- a/docs/changelog.rst Sat Nov 27 20:48:16 2010 +0100
+++ b/docs/changelog.rst Mon Dec 06 23:42:07 2010 +0100
@@ -1,25 +1,31 @@
Changelog
---------
-0.9.13
-~~~~~~
+1.0 (2010.12.06)
+~~~~~~~~~~~~~~~~
+
+ - when middleware was used and command called without arguments, instead of
+ help, traceback was displayed
+
+0.9.13 (2010.11.18)
+~~~~~~~~~~~~~~~~~~~
- fixed exception handling (cleanup previous fix, actually)
- display only name of application, without full path
-0.9.12
-~~~~~~
+0.9.12 (2010.11.02)
+~~~~~~~~~~~~~~~~~~~
- fixed trouble with non-ascii characters in docstrings
-0.9.11
-~~~~~~
+0.9.11 (2010.09.19)
+~~~~~~~~~~~~~~~~~~~
- fixed exceptions handling
- autocompletion improvements (skips middleware, ability of options completion)
-0.9.10
-~~~~~~
+0.9.10 (2010.04.10)
+~~~~~~~~~~~~~~~~~~~
- if default value of an option is a fuction, always call it (None is passed in
case when option is not supplied)
@@ -27,55 +33,7 @@
- some cleanup with better support for python 3
- initial support for autocompletion (borrowed from PIP)
-0.9.9
-~~~~~
- - 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
-
-0.9.8
-~~~~~
-Fixed bug with option names clashing with name of arguments for call_cmd.
-
-0.9.7
-~~~~~
-Library renamed to opster.
-
-0.9.6
-~~~~~
- - Checks for option definition: long name should be specified always, short
- name should be 1 character in length if available.
- - More specific argument name in guessed usage (this happens if you have not
- specified usage for command).
- - Ability to add global decorator for all commands. See ``test.py`` in
- repository for example: ``ui`` object, to handle verbose/quiet options.
+0.9 - 0.9.9 (since 2009.07.13)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-0.9.5
-~~~~~
-Fixed bug, which prevented programs to work without arguments (displayed help
-instead) if they are not using subcommands.
-
-0.9.4
-~~~~~
- - Ability to hide subcommands from help listing.
- - Append program name to subcommand usage.
-
-0.9.3
-~~~~~
-Minor fix for setup.py, to avoid troubles with installing when there is no docs
-in package.
-
-0.9.2
-~~~~~
-Ability to call commands as regular functions, using arguments and keyword
-arguments.
-
-0.9.1
-~~~~~
-Fixed problem with multiple help options in subcommands
-
-0.9
-~~~
-Initial version
+Ancient history ;-)
--- a/opster.py Sat Nov 27 20:48:16 2010 +0100
+++ b/opster.py Mon Dec 06 23:42:07 2010 +0100
@@ -1,4 +1,4 @@
-# (c) Alexander Solovyov, 2009, under terms of the new BSD License
+# (c) Alexander Solovyov, 2009-2010, under terms of the new BSD License
'''Command line arguments parser
'''
@@ -6,7 +6,7 @@
from itertools import imap
__all__ = ['command', 'dispatch']
-__version__ = '0.9.13'
+__version__ = '1.0'
__author__ = 'Alexander Solovyov'
__email__ = 'piranha@piranha.org.ua'
@@ -149,7 +149,8 @@
if name == '_completion': # skip middleware
worker = lambda: call_cmd(name, func)(*args, **kwargs)
else:
- worker = lambda: call_cmd(name, middleware(func))(*args, **kwargs)
+ worker = lambda: (call_cmd(name, middleware(func), depth=2)
+ (*args, **kwargs))
try:
return catcher(worker, help_func)
@@ -480,12 +481,16 @@
err('%s\n' % e)
raise Abort()
-def call_cmd(name, func):
+def call_cmd(name, func, depth=1):
+ '''Wrapper for command call, catching situation with insufficient arguments
+
+ ``depth`` is necessary when there is a middleware in setup
+ '''
def inner(*args, **kwargs):
try:
return func(*args, **kwargs)
except TypeError:
- if len(traceback.extract_tb(sys.exc_info()[2])) == 1:
+ if len(traceback.extract_tb(sys.exc_info()[2])) == depth:
raise ParseError(name, "invalid arguments")
raise
return inner
--- a/setup.py Sat Nov 27 20:48:16 2010 +0100
+++ b/setup.py Mon Dec 06 23:42:07 2010 +0100
@@ -23,9 +23,8 @@
version = opster.__version__,
author = opster.__author__,
author_email = opster.__email__,
- url = 'http://hg.piranha.org.ua/opster/',
+ url = 'http://hg.piranha.org.ua/opster/docs/',
classifiers = [
- 'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',