# HG changeset patch # User Alexander Solovyov <piranha@piranha.org.ua> # Date 1249652856 -10800 # Node ID b5bf4c1f3a68494dbdec962e11c5f9ef5b146ce7 # Parent 78fa11005c8384623e90fa0ed7bd06c816075f99 check that option has a name diff -r 78fa11005c83 -r b5bf4c1f3a68 finaloption.py --- a/finaloption.py Fri Aug 07 16:47:17 2009 +0300 +++ b/finaloption.py Fri Aug 07 16:47:36 2009 +0300 @@ -124,8 +124,7 @@ lambda: call_cmd(name, middleware(func), *args, **kwargs), help_func) except Abort: - pass - return -1 + return -1 # -------- # Help @@ -267,6 +266,9 @@ if short and len(short) != 1: raise FOError('Short option should be only a single' ' character: %s' % short) + if not name: + raise FOError( + 'Long name should be defined for every option') # change name to match Python styling pyname = name.replace('-', '_') argmap['-' + short] = argmap['--' + name] = pyname diff -r 78fa11005c83 -r b5bf4c1f3a68 test_cmd.py --- a/test_cmd.py Fri Aug 07 16:47:17 2009 +0300 +++ b/test_cmd.py Fri Aug 07 16:47:36 2009 +0300 @@ -16,10 +16,9 @@ ('p', 'port', 5000, 'The port for the server.'), ('', 'nolint', False, 'Do not use LintMiddleware') ]) -def runserver(config, host, port, nolint): +def runserver(**opts): """Run development server""" - - pass + print opts finaloption.dispatch()