2008-02-25 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/ReportBase/_ArgHandler.py (ArgHandler.cl_action): improve output when no report or tool name is given. Remove call to sys.exit(1) as it means that gui error report handler is called (locks db). addresses part of #0001821 svn: r10118
This commit is contained in:
parent
3d1d81b746
commit
46dad9bae3
@ -1,3 +1,9 @@
|
||||
2008-02-25 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||
* src/ReportBase/_ArgHandler.py (ArgHandler.cl_action): improve output
|
||||
when no report or tool name is given. Remove call to sys.exit(1) as it
|
||||
means that gui error report handler is called (locks db).
|
||||
addresses part of #0001821
|
||||
|
||||
2008-02-25 Łukasz Rymarczyk <yenidai(at)poczta(dot)onet(dot)pl>
|
||||
* src/ReportBase/_CommandLineReport.py: add user friendly output to cli
|
||||
gramps.py -u --open=merge --action=report -p "name=indiv_complete,show=all"
|
||||
|
@ -4,6 +4,7 @@
|
||||
# Copyright (C) 2000-2006 Donald N. Allingham, A. Roitman
|
||||
# Copyright (C) 2007-2008 B. Malengier
|
||||
# Copyright (C) 2008 Lukasz Rymarczyk
|
||||
# Copyright (C) 2008 Raphael Ackermann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -706,7 +707,6 @@ class ArgHandler:
|
||||
def cl_action(self, action, options_str):
|
||||
"""
|
||||
Command-line action routine. Try to perform specified action.
|
||||
Any errors will cause the sys.exit(1) call.
|
||||
"""
|
||||
if action == 'check':
|
||||
import Check
|
||||
@ -731,10 +731,7 @@ class ArgHandler:
|
||||
print "Ignoring invalid options string."
|
||||
|
||||
name = options_str_dict.pop('name', None)
|
||||
if not name:
|
||||
print "Report name not given. Please use name=reportname"
|
||||
sys.exit(1)
|
||||
|
||||
if name:
|
||||
for item in cl_list:
|
||||
if name == item[0]:
|
||||
category = item[1]
|
||||
@ -747,8 +744,12 @@ class ArgHandler:
|
||||
cl_report(self.state.db, name, category, report_class,
|
||||
options_class, options_str_dict)
|
||||
return
|
||||
# name exists, but is not in the list of valid report names
|
||||
msg = "Unknown report name."
|
||||
else:
|
||||
msg = "Report name not given. Please use -p name=reportname."
|
||||
|
||||
print "Unknown report name. Available names are:"
|
||||
print "%s\n Available names are:" % msg
|
||||
for item in cl_list:
|
||||
# Print cli report name ([item[0]) and GUI report name (item[4])
|
||||
if len(item[0]) <= 25:
|
||||
@ -756,6 +757,7 @@ class ArgHandler:
|
||||
" " * (26 - len(item[0])), item[4])
|
||||
else:
|
||||
print " %s\t- %s" % (item[0], item[4])
|
||||
|
||||
elif action == "tool":
|
||||
try:
|
||||
options_str_dict = dict( [ tuple(chunk.split('=')) for
|
||||
@ -765,10 +767,7 @@ class ArgHandler:
|
||||
print "Ignoring invalid options string."
|
||||
|
||||
name = options_str_dict.pop('name', None)
|
||||
if not name:
|
||||
print "Tool name not given. Please use name=toolname"
|
||||
sys.exit(1)
|
||||
|
||||
if name:
|
||||
for item in cli_tool_list:
|
||||
if name == item[0]:
|
||||
category = item[1]
|
||||
@ -777,8 +776,11 @@ class ArgHandler:
|
||||
Tool.cli_tool(self.state, name, category, tool_class,
|
||||
options_class, options_str_dict)
|
||||
return
|
||||
msg = "Unknown tool name."
|
||||
else:
|
||||
msg = "Tool name not given. Please use -p name=toolname."
|
||||
|
||||
print "Unknown tool name. Available names are:"
|
||||
print "%s\n Available names are:" % msg
|
||||
for item in cli_tool_list:
|
||||
print " %s" % item[0]
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user