# HG changeset patch # User Pascal Volk # Date 1320794730 0 # Node ID 5d0114f7bb999d4cb0219e1da3fd910fad42d44a # Parent 807ad4df07748de7cb508505aefc12b8ec864012 VMM/cli/subcommands: Use the common output formatting in list_pwschemes(). diff -r 807ad4df0774 -r 5d0114f7bb99 VirtualMailManager/cli/subcommands.py --- a/VirtualMailManager/cli/subcommands.py Tue Nov 08 21:31:30 2011 +0000 +++ b/VirtualMailManager/cli/subcommands.py Tue Nov 08 23:25:30 2011 +0000 @@ -427,21 +427,21 @@ def list_pwschemes(ctx_unused): """Prints all usable password schemes and password encoding suffixes.""" + # TODO: Remove trailing colons from keys. + # For now it is to late, the translators has stared their work keys = (_(u'Usable password schemes:'), _(u'Usable encoding suffixes:')) old_ii, old_si = txt_wrpr.initial_indent, txt_wrpr.subsequent_indent - txt_wrpr.initial_indent = '' - indent = 0 + txt_wrpr.initial_indent = txt_wrpr.subsequent_indent = '\t' + txt_wrpr.width = txt_wrpr.width - 8 - for key in keys: - k_len = len(key) - if k_len > indent: - indent = k_len - txt_wrpr.subsequent_indent = (indent + 1) * ' ' - fmt = '%%-%us %%s' % indent for key, value in zip(keys, list_schemes()): - w_std('\n'.join(txt_wrpr.wrap(fmt % (key, ' '.join(value))))) + if key.endswith(':'): # who knows … (see TODO above) + key = key.rpartition(':')[0] + w_std(key, len(key) * '-') + w_std('\n'.join(txt_wrpr.wrap(' '.join(value))), '') txt_wrpr.initial_indent, txt_wrpr.subsequent_indent = old_ii, old_si + txt_wrpr.width = txt_wrpr.width + 8 def relocated_add(ctx):