aboutsummaryrefslogtreecommitdiffstats
path: root/becommands
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-16 14:12:06 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-16 14:12:06 -0500
commite7c376ed286b3bf741ae9e364eef7dd2114d77c7 (patch)
tree095386a2f4f1d7aac1520b4e9689667decff41cf /becommands
parentdbe327909b048e0709b598fd60f02ef53b25a0ea (diff)
downloadbugseverywhere-e7c376ed286b3bf741ae9e364eef7dd2114d77c7.tar.gz
Added 'remove' command to remove bugs. Use __desc__ for command help.
Using the __desc__ reduces documentation duplication. It's also better than using __doc__, because __doc__ could (should?) be more than one-line long, and we just want a short description to jog our memories in the complete command list. Also moved unique_name from cmdutil.py to names.py to avoid the bug->cmdutil->bugdir->bug cyclic include.
Diffstat (limited to 'becommands')
-rw-r--r--becommands/__init__.py15
-rw-r--r--becommands/close.py2
-rw-r--r--becommands/comment.py2
-rw-r--r--becommands/diff.py2
-rw-r--r--becommands/help.py3
-rw-r--r--becommands/list.py2
-rw-r--r--becommands/new.py3
-rw-r--r--becommands/open.py2
-rw-r--r--becommands/set.py2
-rw-r--r--becommands/set_root.py1
-rw-r--r--becommands/severity.py1
-rw-r--r--becommands/show.py5
-rw-r--r--becommands/template21
-rw-r--r--becommands/upgrade.py1
14 files changed, 36 insertions, 26 deletions
diff --git a/becommands/__init__.py b/becommands/__init__.py
index e69de29..6b07378 100644
--- a/becommands/__init__.py
+++ b/becommands/__init__.py
@@ -0,0 +1,15 @@
+"Command plugins for the BugsEverywhere be script."
+
+__all__ = ["set_root", "set", "new", "remove", "list", "show", "close", "open",
+ "assign", "severity", "status", "target", "comment", "diff",
+ "upgrade", "help"]
+
+def import_all():
+ for i in __all__:
+ name = __name__ + "." + i
+ try:
+ __import__(name, globals(), locals(), [])
+ except ImportError:
+ print "Import of %s failed!" % (name,)
+
+import_all()
diff --git a/becommands/close.py b/becommands/close.py
index 52ab735..8e62b90 100644
--- a/becommands/close.py
+++ b/becommands/close.py
@@ -16,6 +16,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Close a bug"""
from libbe import cmdutil
+__desc__ = __doc__
+
def execute(args):
"""
>>> from libbe import tests
diff --git a/becommands/comment.py b/becommands/comment.py
index 50fdc23..5939490 100644
--- a/becommands/comment.py
+++ b/becommands/comment.py
@@ -18,6 +18,8 @@
from libbe import cmdutil, names, utility
from libbe.bug import new_comment
import os
+__desc__ = __doc__
+
def execute(args):
"""
>>> from libbe import tests, names
diff --git a/becommands/diff.py b/becommands/diff.py
index 82ebb2c..5a3a7cf 100644
--- a/becommands/diff.py
+++ b/becommands/diff.py
@@ -18,6 +18,8 @@
"""Compare bug reports with older tree"""
from libbe import bugdir, diff, cmdutil
import os
+__desc__ = __doc__
+
def execute(args):
options, args = get_parser().parse_args(args)
if len(args) == 0:
diff --git a/becommands/help.py b/becommands/help.py
index 45d35ca..f6cfe3f 100644
--- a/becommands/help.py
+++ b/becommands/help.py
@@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Print help for given subcommand"""
from libbe import cmdutil, names, utility
+__desc__ = __doc__
def execute(args):
"""
@@ -25,7 +26,7 @@ def execute(args):
if len(args) > 1:
raise cmdutil.UserError("Too many arguments.")
if len(args) == 0:
- cmdutil.print_command_list()
+ print cmdutil.help()
else:
try:
print cmdutil.help(args[0])
diff --git a/becommands/list.py b/becommands/list.py
index 4514039..59eb8ad 100644
--- a/becommands/list.py
+++ b/becommands/list.py
@@ -19,6 +19,8 @@ from libbe import cmdutil, names
from libbe.bug import cmp_full, severity_values, status_values, \
active_status_values, inactive_status_values
import os
+__desc__ = __doc__
+
def execute(args):
options, args = get_parser().parse_args(args)
if len(args) > 0:
diff --git a/becommands/new.py b/becommands/new.py
index b22dd0a..40ab3f5 100644
--- a/becommands/new.py
+++ b/becommands/new.py
@@ -17,6 +17,7 @@
"""Create a new bug"""
from libbe import cmdutil, names, utility
from libbe.bug import new_bug
+__desc__ = __doc__
def execute(args):
"""
@@ -47,7 +48,7 @@ def execute(args):
bug.summary = args[0]
bug.save()
bugs = (dir.list())
- print "Created bug with ID %s" % cmdutil.unique_name(bug, bugs)
+ print "Created bug with ID %s" % names.unique_name(bug, bugs)
def get_parser():
parser = cmdutil.CmdOptionParser("be new SUMMARY")
diff --git a/becommands/open.py b/becommands/open.py
index f7c23c1..654a1f5 100644
--- a/becommands/open.py
+++ b/becommands/open.py
@@ -16,6 +16,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Re-open a bug"""
from libbe import cmdutil
+__desc__ = __doc__
+
def execute(args):
"""
>>> from libbe import tests
diff --git a/becommands/set.py b/becommands/set.py
index e359df1..8a76133 100644
--- a/becommands/set.py
+++ b/becommands/set.py
@@ -16,6 +16,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Change tree settings"""
from libbe import cmdutil
+__desc__ = __doc__
+
def execute(args):
"""
>>> from libbe import tests
diff --git a/becommands/set_root.py b/becommands/set_root.py
index 2ae7e1a..cc21c31 100644
--- a/becommands/set_root.py
+++ b/becommands/set_root.py
@@ -16,6 +16,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Assign the root directory for bug tracking"""
from libbe import bugdir, cmdutil, rcs
+__desc__ = __doc__
def execute(args):
"""
diff --git a/becommands/severity.py b/becommands/severity.py
index 1a68c31..6845875 100644
--- a/becommands/severity.py
+++ b/becommands/severity.py
@@ -17,7 +17,6 @@
"""Show or change a bug's severity level"""
from libbe import cmdutil
from libbe.bug import severity_values, severity_description
-
__desc__ = __doc__
def execute(args):
diff --git a/becommands/show.py b/becommands/show.py
index 678a607..669a81d 100644
--- a/becommands/show.py
+++ b/becommands/show.py
@@ -15,9 +15,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Show a particular bug"""
-from libbe import cmdutil, utility
+from libbe import cmdutil, names, utility
from libbe.bug import thread_comments
import os
+__desc__ = __doc__
def execute(args):
options, args = get_parser().parse_args(args)
@@ -26,7 +27,7 @@ def execute(args):
bug_dir = cmdutil.bug_tree()
bug = cmdutil.get_bug(args[0], bug_dir)
print bug.string().rstrip("\n")
- unique_name = cmdutil.unique_name(bug, bug_dir.list())
+ unique_name = names.unique_name(bug, bug_dir.list())
comments = []
name_map = {}
for c_name, comment in cmdutil.iter_comment_name(bug, unique_name):
diff --git a/becommands/template b/becommands/template
deleted file mode 100644
index 3c871e6..0000000
--- a/becommands/template
+++ /dev/null
@@ -1,21 +0,0 @@
-"""Short description"""
-from libbe import bugdir, cmdutil, names
-import os
-def execute(args):
- options, args = get_parser().parse_args(args)
- if len(args) > 0:
- raise cmdutil.UsageError
-
-
-def get_parser():
- parser = cmdutil.CmdOptionParser("be list [options]")
-# parser.add_option("-w", "--wishlist", action="store_true", dest="wishlist",
-# help="List bugs with 'wishlist' severity")
- return parser
-
-longhelp="""
-This is for the longwinded description
-"""
-
-def help():
- return get_parser().help_str() + longhelp
diff --git a/becommands/upgrade.py b/becommands/upgrade.py
index f5b12ef..7ed3630 100644
--- a/becommands/upgrade.py
+++ b/becommands/upgrade.py
@@ -18,6 +18,7 @@
import os.path
import errno
from libbe import bugdir, rcs, cmdutil
+__desc__ = __doc__
def execute(args):
options, args = get_parser().parse_args(args)