summaryrefslogtreecommitdiff
path: root/src/core/completions.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-12-10 23:12:17 +0100
committermathieui <mathieui@mathieui.net>2014-12-10 23:12:17 +0100
commit003c28e953ccce64523946c3d3d6578c436c9f3e (patch)
tree5138d1c6ecd8923219c43bb8be84b847d2e81914 /src/core/completions.py
parent4c7a470dc87686b724d9cfd67b6cb365156021ce (diff)
downloadpoezio-003c28e953ccce64523946c3d3d6578c436c9f3e.tar.gz
poezio-003c28e953ccce64523946c3d3d6578c436c9f3e.tar.bz2
poezio-003c28e953ccce64523946c3d3d6578c436c9f3e.tar.xz
poezio-003c28e953ccce64523946c3d3d6578c436c9f3e.zip
Allow the plugins to use a default configuration too
through overloading the class variable default_config. also fix a bug that would add meaningless sections to plugin configurations.
Diffstat (limited to 'src/core/completions.py')
-rw-r--r--src/core/completions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/completions.py b/src/core/completions.py
index c398e886..bdba6362 100644
--- a/src/core/completions.py
+++ b/src/core/completions.py
@@ -305,7 +305,7 @@ def completion_set(self, the_input):
end_list = ['%s|%s' % (plugin_name, section) for section in plugin.config.sections()]
else:
end_list = set(config.options('Poezio'))
- end_list = end_list.union(set(config.default.get('Poezio', {})))
+ end_list.update(config.default.get('Poezio', {}))
end_list = list(end_list)
end_list.sort()
elif n == 2:
@@ -314,7 +314,10 @@ def completion_set(self, the_input):
if not plugin_name in self.plugin_manager.plugins:
return the_input.new_completion([''], n, quotify=True)
plugin = self.plugin_manager.plugins[plugin_name]
- end_list = plugin.config.options(section or plugin_name)
+ end_list = set(plugin.config.options(section or plugin_name))
+ end_list.update(plugin.config.default.get(section or plugin_name, {}))
+ end_list = list(end_list)
+ end_list.sort()
elif not config.has_option('Poezio', args[1]):
if config.has_section(args[1]):
end_list = config.options(args[1])