summaryrefslogtreecommitdiffstats
path: root/client/bug.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/bug.py')
-rwxr-xr-xclient/bug.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/bug.py b/client/bug.py
index ff7958f..a5c3814 100755
--- a/client/bug.py
+++ b/client/bug.py
@@ -24,10 +24,10 @@ See 'bug help <command>' for more information on a specific command
from importlib import import_module
from subprocess import call
from docopt import docopt
+import sys
commands = ['open', 'delete', 'show', 'list', 'edit']
def main():
-
if args['<command>'] in ['help', None]:
if not args['<args>']:
print(__doc__.lstrip().rstrip())
@@ -36,18 +36,22 @@ def main():
bug_mod = import_module('bug_{}'.format(args['<args>'][0]))
print(bug_mod.__doc__.lstrip().rstrip())
else:
- exit("'{}' is not a bug.py command. See 'bug help'.".format(args['<args>'][0]))
+ sys.exit("'{}' is not a bug.py command. See 'bug help'.".format(args['<args>'][0]))
+
elif args['<command>'] in commands:
if not args['--uri']:
- exit("URI missing")
+ sys.exit("URI missing")
bug_mod = import_module('bug_{}'.format(args['<command>']))
- argv = [args['<command>']] + args['<args>']
- arguments = args.copy()
- arguments.update(docopt(bug_mod.__doc__, argv=argv))
- bug_mod.call(arguments)
+
+ arg = {'--uri': args['--uri']}
+ arg.update(docopt(bug_mod.__doc__,
+ argv=[args['<command>']] + args['<args>']))
+
+ bug_mod.entrypoint(arg)
+
else:
- exit("'{}' is not a bug.py command. See 'bug help'.".format(args['<command>']))
+ sys.exit("'{}' is not a bug.py command. See 'bug help'.".format(args['<command>']))
if __name__ == '__main__':
args = docopt(__doc__,