diff --git a/klugman/base.py b/klugman/base.py index 01bfb59..efce7b7 100644 --- a/klugman/base.py +++ b/klugman/base.py @@ -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 diff --git a/klugman/klugman.py b/klugman/klugman.py index b32a18c..0e8fa52 100644 --- a/klugman/klugman.py +++ b/klugman/klugman.py @@ -59,6 +59,9 @@ def main(): cmd = arguments[''] argv = [cmd] + arguments[''] + print "URL", url + print "ARGUMENTS", arguments + print "ARGV", argv api = impl(url, arguments) if cmd == 'help': print api.__doc__ diff --git a/klugman/v1.py b/klugman/v1.py index ac9196e..3a63f1a 100644 --- a/klugman/v1.py +++ b/klugman/v1.py @@ -26,6 +26,8 @@ class Streams(object): options: --id get stream with id + --details + return events with each stream --state return streams in state --older_than @@ -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 [...] [options] -h, --help show command options """ diff --git a/klugman/v2.py b/klugman/v2.py index 7753abb..668ebea 100644 --- a/klugman/v2.py +++ b/klugman/v2.py @@ -59,11 +59,14 @@ class V2(base.Impl): # Note the [...] [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 [...] [options] + """Klugman - StackTach.v3 client - -h, --help show command options +Usage: + klugman.py [options] streams [...] + klugman.py [options] archives [...] + +Options: + -h, --help show command options """ def __init__(self, base_url, base_args):