Kaydet (Commit) ca0a8aa0 authored tarafından Eray Özkural's avatar Eray Özkural

* show one line description for commands in general help

* less frightening message for normal errors
üst 1a4a015f
......@@ -35,7 +35,7 @@ def handle_exception(exception, value, tb):
ui.error(_("Keyboard Interrupt: Exiting..."))
exit()
elif isinstance(value, pisi.Error):
ui.error(_("Fatal Error. Program Terminated."))
ui.error(_("Program Terminated."))
show_traceback = ctx.get_option('debug')
elif isinstance(value, pisi.Exception):
show_traceback = True
......@@ -50,8 +50,11 @@ Please file a bug report. (http://bugs.uludag.org.tr)"""))
v = ''
for e in value.args:
v += str(e) + '\n'
ui.error("%s: %s" % (exception, v))
if ctx.get_option('debug'):
ui.error("%s: %s" % (exception, v))
else:
ui.error(v)
ui.info(_("Please use 'pisi help' for general help."))
......
......@@ -37,15 +37,18 @@ class Command(object):
cmd = []
cmd_dict = {}
@staticmethod
def commands_string():
s = ''
list = [x.name[0] for x in Command.cmd]
list.sort()
for x in list:
s += x + '\n'
for name in list:
command = Command.get_command(name)
summary = command.__doc__.split('\n')[0]
s += '%25s - %s\n' % (command.format_name(), summary)
return s
commands_string = staticmethod(commands_string)
@staticmethod
def get_command(cmd, fail=False):
if Command.cmd_dict.has_key(cmd):
......@@ -55,7 +58,6 @@ class Command(object):
raise Error(_("Unrecognized command: %s") % cmd)
else:
return None
get_command = staticmethod(get_command)
# instance variabes
......@@ -205,6 +207,7 @@ If run without parameters, it prints the general help."""
name = ("help", "h")
def run(self):
if not self.args:
self.parser.set_usage(usage_text)
pisi.cli.printu(self.parser.format_help())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment