aboutsummaryrefslogtreecommitdiffstats
path: root/be
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2005-03-09 17:37:13 +0000
committerAaron Bentley <abentley@panoramicfeedback.com>2005-03-09 17:37:13 +0000
commit8d6a6a2af58408c4066b753f28d5b13ae6ee587a (patch)
tree360c3f5a11577e64f2010d9f85328a04fab57e03 /be
parenta137e93fb63f88cf47b70ac5bba51a79df47bd41 (diff)
downloadbugseverywhere-8d6a6a2af58408c4066b753f28d5b13ae6ee587a.tar.gz
Moved code into bugdir, handled unknown commands
Diffstat (limited to 'be')
-rwxr-xr-xbe20
1 files changed, 13 insertions, 7 deletions
diff --git a/be b/be
index f1e6cb3..e87ed0b 100755
--- a/be
+++ b/be
@@ -7,7 +7,9 @@ be comment: append a comment to a bug
be set-root: assign the root directory for bug tracking
"""
from libbe.cmdutil import *
+from libbe.bugdir import tree_root
import sys
+import os
def list_bugs(args):
bugs = list(tree_root(os.getcwd()).list())
@@ -16,15 +18,19 @@ def list_bugs(args):
for bug in bugs:
print "%s: %s" % (unique_name(bug, bugs), bug.summary)
-
-
if len(sys.argv) == 1:
print __doc__
else:
- {
- "list": list_bugs
- }[sys.argv[1]](sys.argv[2:])
-
-
+ try:
+ try:
+ cmd = {
+ "list": list_bugs
+ }[sys.argv[1]]
+ except KeyError, e:
+ raise UserError("Unknown command \"%s\"" % e.args[0])
+ cmd(sys.argv[2:])
+ except UserError, e:
+ print e
+ sys.exit(1)