diff options
author | Mark Seger <Mark.Seger@hp.com> | 2014-06-25 12:34:38 +0000 |
---|---|---|
committer | Mark Seger <Mark.Seger@hp.com> | 2014-06-25 14:36:38 +0000 |
commit | 0e302d3d3a8e85e85ec35726b907d2c3b0f77326 (patch) | |
tree | 6eda4b2aea002c10d63dd6cd9b05e488823e125c | |
parent | 3d0de79e26e2aa6285742c60aca3c164e9c2fbb9 (diff) | |
download | python-swiftclient-0e302d3d3a8e85e85ec35726b907d2c3b0f77326.tar.gz |
Add context sensitive help
Change-Id: I9aaadbaba2c43a12a83f8200eaaa96f48c52028e
-rwxr-xr-x | swiftclient/shell.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py index d035388..d10fc70 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -1292,6 +1292,25 @@ def parse_args(parser, args, enforce_requires=True): 'region_name': options.os_region_name, } + if len(args) > 1 and args[1] == '--help': + if args[0] == 'capabilities': + print(st_capabilities_help) + elif args[0] == 'delete': + print(st_delete_help) + elif args[0] == 'download': + print(st_download_help) + elif args[0] == 'list': + print(st_list_help) + elif args[0] == 'post': + print(st_post_help) + elif args[0] == 'stat': + print(st_stat_help) + elif args[0] == 'upload': + print(st_upload_help) + else: + print("no help for %s" % args[0]) + exit() + if len(args) > 1 and args[0] == "capabilities": return options, args @@ -1335,7 +1354,7 @@ usage: %%prog [--version] [--help] [--snet] [--verbose] [--os-endpoint-type <endpoint-type>] [--os-cacert <ca-certificate>] [--insecure] [--no-ssl-compression] - <subcommand> ... + <subcommand> [--help] Command-line interface to the OpenStack Swift API. @@ -1354,6 +1373,8 @@ Positional arguments: Examples: + %%prog download --help + %%prog -A https://auth.api.rackspacecloud.com/v1.0 -U user -K api_key stat -v %%prog --os-auth-url https://api.example.com/v2.0 --os-tenant-name tenant \\ |