Make zsh bindings support string override variants

Ref #1201
This commit is contained in:
ZyX 2015-01-06 22:12:56 +03:00
parent 917dfed842
commit 4f268cb887
1 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,7 @@ from weakref import WeakValueDictionary, ref
import zsh
from powerline.shell import ShellPowerline
from powerline.lib.overrides import parsedotval
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.unicode import unicode, u
from powerline.lib.encoding import (get_preferred_output_encoding,
get_preferred_environment_encoding)
@ -25,7 +25,13 @@ def shutdown():
def get_var_config(var):
try:
return mergeargs([parsedotval((u(k), u(v))) for k, v in zsh.getvalue(var).items()])
val = zsh.getvalue(var)
if isinstance(val, dict):
return mergeargs([parsedotval((u(k), u(v))) for k, v in val.items()])
elif isinstance(val, (unicode, str, bytes)):
return mergeargs(parse_override_var(u(val)))
else:
return None
except:
return None