From c21687134c88b4107ba3411f6c5d0b2cc6692fb5 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 97c389103..1478924b1 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: