diff options
author | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-23 18:35:02 +0000 |
---|---|---|
committer | Aaron Bentley <abentley@panoramicfeedback.com> | 2005-03-23 18:35:02 +0000 |
commit | 474c701d79c3c7b54fcfcbcbc4be183ccadf7f21 (patch) | |
tree | aa786d4725b7011212bd9c419d73cfce9be1790f | |
parent | db039bf8987e6148bca5fc3bd417ad0d04dfa3ab (diff) | |
download | bugseverywhere-474c701d79c3c7b54fcfcbcbc4be183ccadf7f21.tar.gz |
Made comment work with an editor
-rw-r--r-- | becommands/comment.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/becommands/comment.py b/becommands/comment.py index f162969..358acd2 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -1,12 +1,21 @@ """Add a comment to a bug""" -from libbe import bugdir, cmdutil, names +from libbe import bugdir, cmdutil, names, utility import os def execute(args): options, args = get_parser().parse_args(args) - if len(args) < 2: + if len(args) < 1: raise cmdutil.UsageError() bug = cmdutil.get_bug(args[0]) - comment = bugdir.new_comment(bug, args[1]) + if len(args) == 1: + body = utility.editor_string() + if body is None: + raise cmdutil.UserError("No comment entered.") + else: + body = args[1] + if not body.endswith('\n'): + body+='\n' + + comment = bugdir.new_comment(bug, body) comment.save() |