diff options
author | mathieui <mathieui@mathieui.net> | 2015-04-12 18:10:33 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-04-12 18:10:33 +0200 |
commit | ee6c7d374a87df3479c081b3a4070c59e90ebf34 (patch) | |
tree | db0788ef1419ba8ffa0c632836bf3fecb3f6266e | |
parent | 190c7a4a7b27213a7c1e080b21333557cdf4dee3 (diff) | |
download | poezio-ee6c7d374a87df3479c081b3a4070c59e90ebf34.tar.gz poezio-ee6c7d374a87df3479c081b3a4070c59e90ebf34.tar.bz2 poezio-ee6c7d374a87df3479c081b3a4070c59e90ebf34.tar.xz poezio-ee6c7d374a87df3479c081b3a4070c59e90ebf34.zip |
Fix #3035 (display config values on empty /set)
-rw-r--r-- | src/core/commands.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/core/commands.py b/src/core/commands.py index fdeea8f7..bf649161 100644 --- a/src/core/commands.py +++ b/src/core/commands.py @@ -536,14 +536,27 @@ def command_remove_bookmark(self, args): else: self.information(_('No bookmark to remove'), 'Info') -@command_args_parser.quoted(1, 2) +@command_args_parser.quoted(0, 2) def command_set(self, args): """ /set [module|][section] <option> [value] """ - if args is None: - return self.command_help('set') - if len(args) == 1: + if args is None or len(args) == 0: + config_dict = config.to_dict() + lines = [] + theme = get_theme() + for section_name, section in config_dict.items(): + lines.append('\x19%(section_col)s}[%(section)s]\x19o' % + { + 'section': section_name, + 'section_col': dump_tuple(theme.COLOR_INFORMATION_TEXT), + }) + for option_name, option_value in section.items(): + lines.append('%s\x19%s}=\x19o%s' % (option_name, + dump_tuple(theme.COLOR_REVISIONS_MESSAGE), + option_value)) + info = ('Current options:\n%s' % '\n'.join(lines), 'Info') + elif len(args) == 1: option = args[0] value = config.get(option) info = ('%s=%s' % (option, value), 'Info') |