diff options
author | W. Trevor King <wking@drexel.edu> | 2010-01-21 13:14:08 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2010-01-21 13:14:08 -0500 |
commit | 36b970de8e5a4b2e1b91372742ce86819c4254b5 (patch) | |
tree | 4ef1870c35dd3b6daaaf3f7453a4bd60ec33c149 /libbe/ui/command_line.py | |
parent | 4ad9a6d7b17db9abe7d4c11477df1df7c6eac5e5 (diff) | |
parent | 508c0c0ec73bdcb802d18b30a6e5f40a04dfed52 (diff) | |
download | bugseverywhere-36b970de8e5a4b2e1b91372742ce86819c4254b5.tar.gz |
Merge assorted bugfixes and optimizations.
Highlights:
* `be new` adds creator field like its supposed to (oops :p).
* `be list --xml` uses <be-xml> format (was <bugs>).
* `be import-xml` handles root comments appropriately.
* `be` raises an appropriate help message.
* `be help` works.
* `be html` prints Comment.id.user() information.
* better SavedSettingsObject._get_saved_settings() avoids data loss.
* be-mbox-to-xml -> be-mail-to-xml and adds assorted format support.
* be-xml-to-mbox and be-handle-mail work with new libbe layout.
* BugDir.uuids() now caches on-disk uuids for speed.
* Mercurial detection works for mercurial <= 1.1.2 _and_ >= 1.2
* Fix bugs in VCS._children() relative/absolute path handling.
Diffstat (limited to 'libbe/ui/command_line.py')
-rw-r--r-- | libbe/ui/command_line.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py index 7ba6cf5..89d791d 100644 --- a/libbe/ui/command_line.py +++ b/libbe/ui/command_line.py @@ -250,6 +250,16 @@ class BE (libbe.command.Command): def full_version(self, *args): return libbe.version.version(verbose=True) +class CommandLine (libbe.command.UserInterface): + def __init__(self, *args, **kwargs): + libbe.command.UserInterface.__init__(self, *args, **kwargs) + self.restrict_file_access = False + self.storage_callbacks = None + def help(self): + be = BE(ui=self) + self.setup_command(be) + return be.help() + def dispatch(ui, command, args): parser = CmdOptionParser(command) try: @@ -273,9 +283,7 @@ def dispatch(ui, command, args): def main(): io = libbe.command.StdInputOutput() - ui = libbe.command.UserInterface(io) - ui.restrict_file_access = False - ui.storage_callbacks = None + ui = CommandLine(io) be = BE(ui=ui) ui.setup_command(be) @@ -285,7 +293,14 @@ def main(): except CallbackExit: return 0 except libbe.command.UserError, e: - print >> ui.io.stdout, 'ERROR:\n', e + if str(e).endswith('COMMAND'): + # no command given, print usage string + print >> ui.io.stdout, 'ERROR:' + print >> ui.io.stdout, be.usage(), '\n', e + print >> ui.io.stdout, 'For example, try' + print >> ui.io.stdout, ' be help' + else: + print >> ui.io.stdout, 'ERROR:\n', e return 1 command_name = args.pop(0) @@ -299,7 +314,7 @@ def main(): command = Class(ui=ui) ui.setup_command(command) - if command.name in ['comment', 'commit', 'serve']: + if command.name in ['comment', 'commit', 'import-xml', 'serve']: paginate = 'never' else: paginate = 'auto' |