summaryrefslogtreecommitdiffstats
path: root/client/bug.py
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-10-05 01:30:14 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-10-05 01:30:14 +0200
commit99f748ed7f445c5dfb019b6327d119e08f00cad4 (patch)
tree6310abef82613afc1fa6b23b4a3855a4e519f1eb /client/bug.py
parent571976cb2780ab0272b95b05bff860a3b8f04cc9 (diff)
downloadtbt-master.tar.xz
another massive commitHEADmaster
all of this should be squashed later.. at least most of it works now, I think... I should add some tests probably.
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__,