--- a/opster.py Wed Sep 02 12:50:52 2009 +0300
+++ b/opster.py Thu Sep 03 22:06:14 2009 +0300
@@ -316,10 +316,9 @@
# --------
def _dispatch(args, cmdtable, globalopts):
- cmd, func, args, options, globaloptions = cmdparse(args, cmdtable,
- globalopts)
+ cmd, func, args, options = cmdparse(args, cmdtable, globalopts)
- if globaloptions['help']:
+ if options.pop('help', False):
return 'help', cmdtable['help'][0], [cmd], {}
elif not cmd:
return 'help', cmdtable['help'][0], ['shortlist'], {}
@@ -350,12 +349,7 @@
except getopt.GetoptError, e:
raise ParseError(cmd, e)
- globaloptions = {}
- for o in globalopts:
- name = o[1]
- globaloptions[name] = options.pop(name)
-
- return (cmd, cmd and info[0] or None, args, options, globaloptions)
+ return (cmd, cmd and info[0] or None, args, options)
def findpossible(cmd, table):
"""
--- a/test.py Wed Sep 02 12:50:52 2009 +0300
+++ b/test.py Thu Sep 03 22:06:14 2009 +0300
@@ -28,7 +28,10 @@
if opts.get('pass'):
return
# test ui
- ui.write('preved\n')
+ ui.write('write\n')
+ ui.note('note\n')
+ ui.info('info\n')
+ ui.warn('warn\n')
if opts.get('exit'):
sys.exit(opts['exit'])
@@ -82,5 +85,3 @@
if __name__ == '__main__':
dispatch(globaloptions=UI.options, middleware=ui_middleware)
-
-