From 65442c2da81dc0f167d99958fc5cb01a747e1782 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Fri, 22 Jan 2016 13:39:37 -0800 Subject: [PATCH] Bug 9191: Unable to select Unicode UTF-8 encoding on command line Make the option descriptions line up when the value is shorter than 10 characters. Also make the value and description headings line up with the list and put "Available values are:" first. --- gramps/cli/plug/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gramps/cli/plug/__init__.py b/gramps/cli/plug/__init__.py index e2ecdead9..3247e388e 100644 --- a/gramps/cli/plug/__init__.py +++ b/gramps/cli/plug/__init__.py @@ -413,7 +413,13 @@ class CommandLineReport(object): elif isinstance(option, EnumeratedListOption): ilist = [] for (value, description) in option.get_items(): - ilist.append("%s\t%s" % (value, description)) + tabs = '\t' + try: + tabs = '\t\t' if len(value) < 10 else '\t' + except TypeError: #Value is a number, use just one tab. + pass + val = "%s%s%s" % (value, tabs, description) + ilist.append(val) self.options_help[name].append(ilist) elif isinstance(option, Option): self.options_help[name].append(option.get_help()) @@ -587,8 +593,8 @@ class CommandLineReport(object): elif self.show in self.options_help: opt = self.options_help[self.show] tabs = '\t\t' if len(self.show) < 10 else '\t' - print(' %s%s%s (%s)' % (self.show, tabs, opt[1], opt[0])) print(_(" Available values are:")) + print(' %s%s%s (%s)' % (self.show, tabs, opt[1], opt[0])) vals = opt[2] if isinstance(vals, (list, tuple)): for val in vals: