fixed up parameter in child implementations
This commit is contained in:
parent
6cce25456c
commit
37e2f1f8fa
@ -46,7 +46,8 @@ class Impl(object):
|
||||
self.docs = docs
|
||||
|
||||
def dispatch(self, cmdline):
|
||||
arguments = docopt(self.docs, argv=cmdline, help=False)
|
||||
arguments = docopt(self.docs, argv=cmdline, help=False,
|
||||
options_first=True)
|
||||
if self.base_args['--debug']:
|
||||
print arguments
|
||||
|
||||
|
@ -59,6 +59,9 @@ def main():
|
||||
cmd = arguments['<command>']
|
||||
argv = [cmd] + arguments['<args>']
|
||||
|
||||
print "URL", url
|
||||
print "ARGUMENTS", arguments
|
||||
print "ARGV", argv
|
||||
api = impl(url, arguments)
|
||||
if cmd == 'help':
|
||||
print api.__doc__
|
||||
|
@ -26,6 +26,8 @@ class Streams(object):
|
||||
options:
|
||||
--id <id>
|
||||
get stream with id
|
||||
--details
|
||||
return events with each stream
|
||||
--state <state>
|
||||
return streams in state
|
||||
--older_than <datetime>
|
||||
@ -71,22 +73,26 @@ class Streams(object):
|
||||
younger = arguments.get('--younger_than')
|
||||
trigger = arguments.get('--trigger_name')
|
||||
traits = arguments.get('--distinquishing_traits')
|
||||
details = arguments.get('--details')
|
||||
|
||||
cmd = "streams"
|
||||
if sid:
|
||||
cmd = "streams/%d" % sid
|
||||
cmd = "streams/%s" % sid
|
||||
return base.get(version.base_url, cmd, {'details': details})
|
||||
|
||||
params = base.remove_empty({'state': state,
|
||||
'older_than': older,
|
||||
'younger_than': younger,
|
||||
'trigger_name': trigger,
|
||||
'distinquishing_traits': traits})
|
||||
'distinquishing_traits': traits,
|
||||
'details': details})
|
||||
|
||||
return base.get(version.base_url, cmd, params)
|
||||
|
||||
|
||||
class V1(base.Impl):
|
||||
"""usage:
|
||||
klugman.py streams [options]
|
||||
klugman.py streams [<args>...] [options]
|
||||
|
||||
-h, --help show command options
|
||||
"""
|
||||
|
@ -59,11 +59,14 @@ class V2(base.Impl):
|
||||
# Note the [<args>...] [options] approach
|
||||
# which basically says "anything is acceptable".
|
||||
# We will be more strict in the actual command handler.
|
||||
"""usage:
|
||||
klugman.py streams [options]
|
||||
klugman.py archives [<args>...] [options]
|
||||
"""Klugman - StackTach.v3 client
|
||||
|
||||
-h, --help show command options
|
||||
Usage:
|
||||
klugman.py [options] streams [<args>...]
|
||||
klugman.py [options] archives [<args>...]
|
||||
|
||||
Options:
|
||||
-h, --help show command options
|
||||
"""
|
||||
|
||||
def __init__(self, base_url, base_args):
|
||||
|
Loading…
x
Reference in New Issue
Block a user