From 3d1d81b746c58d81c7871c75a9f2eefe69c87b01 Mon Sep 17 00:00:00 2001 From: Raphael Ackermann Date: Mon, 25 Feb 2008 08:59:40 +0000 Subject: [PATCH] =?UTF-8?q?2008-02-25=20=C5=81ukasz=20Rymarczyk=20=20=09*=20src/ReportBase/=5FCommandL?= =?UTF-8?q?ineReport.py:=20add=20user=20friendly=20output=20to=20cli=20=09?= =?UTF-8?q?gramps.py=20-u=20--open=3Dmerge=20--action=3Dreport=20-p=20"nam?= =?UTF-8?q?e=3Dindiv=5Fcomplete,show=3Dall"=20=09#0001823?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn: r10117 --- ChangeLog | 5 +++++ src/ReportBase/_CommandLineReport.py | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index da79607bb..643542aec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-25 Łukasz Rymarczyk + * src/ReportBase/_CommandLineReport.py: add user friendly output to cli + gramps.py -u --open=merge --action=report -p "name=indiv_complete,show=all" + #0001823 + 2008-02-25 Łukasz Rymarczyk * src/ArgHandler.py: add UI Report Names to output 0001826: Command line - viewing available reports nicer to read diff --git a/src/ReportBase/_CommandLineReport.py b/src/ReportBase/_CommandLineReport.py index 80a12f392..49ee568e5 100644 --- a/src/ReportBase/_CommandLineReport.py +++ b/src/ReportBase/_CommandLineReport.py @@ -2,6 +2,7 @@ # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2001-2007 Donald N. Allingham +# Copyright (C) 2008 Lukasz Rymarczyk # # 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 @@ -198,14 +199,27 @@ class CommandLineReport: self.options_help['style'].append(False) def show_options(self): + """ + Print available options on the CLI. + """ if not self.show: return elif self.show == 'all': print " Available options:" for key in self.options_dict.keys(): - print " %s" % key - print \ - " Use 'show=option' to see description and acceptable values" + if key in self.options_dict.keys(): + # Make the output nicer to read, assume that tab has 8 spaces + if len(key) < 10: + print " %s\t\t%s (%s)" % (key, + self.options_help[key][1], + self.options_help[key][0]) + else: + print " %s\t%s (%s)" % (key, + self.options_help[key][1], + self.options_help[key][0]) + else: + print " %s" % key + print " Use 'show=option' to see description and acceptable values" elif self.show in self.options_dict.keys(): print ' %s%s\t%s' % (self.show, self.options_help[self.show][0],