displays an error message if a command fails, so that the user knows something went wrong
This commit is contained in:
@@ -1098,8 +1098,8 @@ def main():
|
|||||||
script_name = argv.pop(0)
|
script_name = argv.pop(0)
|
||||||
if len(argv) < 1:
|
if len(argv) < 1:
|
||||||
print script_name + " category action [<args>]"
|
print script_name + " category action [<args>]"
|
||||||
print "Available categories:"
|
print _("Available categories:")
|
||||||
for k, _ in CATEGORIES:
|
for k, _v in CATEGORIES:
|
||||||
print "\t%s" % k
|
print "\t%s" % k
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
category = argv.pop(0)
|
category = argv.pop(0)
|
||||||
@@ -1110,7 +1110,7 @@ def main():
|
|||||||
actions = methods_of(command_object)
|
actions = methods_of(command_object)
|
||||||
if len(argv) < 1:
|
if len(argv) < 1:
|
||||||
print script_name + " category action [<args>]"
|
print script_name + " category action [<args>]"
|
||||||
print "Available actions for %s category:" % category
|
print _("Available actions for %s category:") % category
|
||||||
for k, _v in actions:
|
for k, _v in actions:
|
||||||
print "\t%s" % k
|
print "\t%s" % k
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@@ -1122,9 +1122,12 @@ def main():
|
|||||||
fn(*argv)
|
fn(*argv)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print "Possible wrong number of arguments supplied"
|
print _("Possible wrong number of arguments supplied")
|
||||||
print "%s %s: %s" % (category, action, fn.__doc__)
|
print "%s %s: %s" % (category, action, fn.__doc__)
|
||||||
raise
|
raise
|
||||||
|
except:
|
||||||
|
print _("Command failed, please check log for more info")
|
||||||
|
raise
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user