doc:config: use :file: to markup filenames.
[be.git] / be
diff --git a/be b/be
index 1dbcee0e7a40130fcee3bdb641552fd2634fd827..8a3d1d9eafdd72476f1e4b506a22fbd69af415f2 100755 (executable)
--- a/be
+++ b/be
@@ -1,86 +1,26 @@
 #!/usr/bin/env python
-"""Bugs Everywhere - Distributed bug tracking
+# Copyright (C) 2005-2012 Aaron Bentley <abentley@panoramicfeedback.com>
+#                         Chris Ball <cjb@laptop.org>
+#                         Gianluca Montecchi <gian@grys.it>
+#                         Oleg Romanyshyn <oromanyshyn@panoramicfeedback.com>
+#                         W. Trevor King <wking@tremily.us>
+#
+# This file is part of Bugs Everywhere.
+#
+# Bugs Everywhere is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 2 of the License, or (at your option) any
+# later version.
+#
+# Bugs Everywhere is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Bugs Everywhere.  If not, see <http://www.gnu.org/licenses/>.
 
-Supported commands
- set-root: assign the root directory for bug tracking
-      new: Create a new bug
-     list: list bugs
-     show: show a particular bug
-    close: close a bug
-     open: re-open a bug
-
-Unimplemented commands
-  comment: append a comment to a bug
-"""
-from libbe.cmdutil import *
-from libbe.bugdir import tree_root, create_bug_dir
-from libbe import names
 import sys
-import os
-
-def list_bugs(args):
-    active = True
-    severity = ("minor", "serious", "critical", "fatal")
-    def filter(bug):
-        if active is not None:
-            if bug.active != active:
-                return False
-        if bug.severity not in severity:
-            return False
-        return True
-    all_bugs = list(tree_root(os.getcwd()).list())
-    bugs = [b for b in all_bugs if filter(b) ]
-    if len(bugs) == 0:
-        print "No matching bugs found"
-    for bug in bugs:
-        print bug_summary(bug, all_bugs)
-
-def show_bug(args):
-    bug_dir = tree_root(os.getcwd())
-    if len(args) !=1:
-        raise UserError("Please specify a bug id.")
-    print bug_summary(get_bug(args[0], bug_dir), list(bug_dir.list()))
-
-def set_root(args):
-    if len(args) != 1:
-        raise UserError("Please supply a directory path")
-    create_bug_dir(args[0])
-
-def new_bug(args):
-    if len(args) != 1:
-        raise UserError("Please supply a summary message")
-    dir = tree_root(".")
-    bugs = (dir.list())
-    bug = dir.new_bug()
-    bug.creator = names.creator()
-    bug.severity = "minor"
-    bug.status = "open"
-    bug.summary = args[0]
-
-def close_bug(args):
-    assert(len(args) == 1)
-    get_bug(args[0], tree_root('.')).status = "closed"
-
-def open_bug(args):
-    assert(len(args) == 1)
-    get_bug(args[0], tree_root('.')).status = "open"
+import libbe.ui.command_line
 
-if len(sys.argv) == 1:
-    print __doc__
-else:
-    try:
-        try:
-            cmd = {
-                "list": list_bugs,
-                "show": show_bug,
-                "set-root": set_root,
-                "new": new_bug,
-                "close": close_bug,
-                "open": open_bug,
-            }[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)
+sys.exit(libbe.ui.command_line.main())