Commit e589a3bf authored by adam j hartz's avatar adam j hartz

some updates to 'settings' objects to make plugins easier to handle

parent 462eb4aa
......@@ -48,7 +48,12 @@ class Settings(dict):
return name.upper() in self.manually_set
def __repr__(self):
return 'Settings(%s)' % dict.__repr__(self)
return 'Settings(%r)' % {k:v for k,v in self.items() if k != 'MANUALLY_SET'}
def __iter__(self):
for key in self.keys():
if key != 'MANUALLY_SET':
yield key
DEFAULT_PROMPT = ('{BOLD_GREEN}{user}@{hostname}'
'{BOLD_BLUE} {cwd} {prompt_end}{NO_COLOR} ')
......@@ -131,7 +136,7 @@ defaults = {
'/usr/share/bash-completion/completions'),
'HISTORY_SIZE': 8128,
'SHELL_TYPE': 'readline',
'PLUGINS': {},
'PLUGINS': Settings(),
}
defaults['HISTORY_FILE'] = os.path.join(defaults['DATA_DIR'], 'history')
......
......@@ -98,7 +98,7 @@ class Shell(object):
try:
new_env = PluginEnv(env_contents, parent=ctx)
self.execer.exec(open(full_path).read(), glbs=new_env)
settings.plugins[name] = new_env
settings.plugins[name.upper()] = new_env['PLUGIN_SETTINGS']
except:
print('Error loading plugin %s' % name)
display_error_message()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment