Fix alias handling

This commit is contained in:
Florian Bruhin 2017-06-16 12:57:17 +02:00
parent f5d2c48bbb
commit 22f096088b

View File

@ -106,11 +106,15 @@ class CommandRunner(QObject):
The new command string if an alias was found. Default value The new command string if an alias was found. Default value
otherwise. otherwise.
""" """
if config.val.aliases is None:
return default
parts = text.strip().split(maxsplit=1) parts = text.strip().split(maxsplit=1)
try: try:
alias = config.val.aliases[parts[0]] alias = config.val.aliases[parts[0]]
except KeyError: except KeyError:
return default return default
try: try:
new_cmd = '{} {}'.format(alias, parts[1]) new_cmd = '{} {}'.format(alias, parts[1])
except IndexError: except IndexError: