Skip to content
Snippets Groups Projects
Commit ec708438 authored by Seblu's avatar Seblu
Browse files

Alias substitution is now handled in alias manager

parent 3e991997
No related branches found
No related tags found
No related merge requests found
......@@ -112,10 +112,8 @@ class Cli(object):
if len(argv) == 0:
continue
# alias subsitution
if argv[0] in self.aliases:
oldargv = argv[1:]
argv = shlex.split(self.aliases[argv[0]])
argv.extend(oldargv)
argv = self.aliases.substitute(argv)
# command execution
self._exec_command(argv)
except KeyboardInterrupt:
self.printer.out("")
......
......@@ -7,6 +7,7 @@ CloudControl CLI commands module
import re
import ConfigParser
import os
import shlex
from cccli.exception import *
from cccli.command import *
......@@ -98,3 +99,10 @@ class Aliases(dict):
for n,v in self.items():
fparser.set("alias", n, v)
fparser.write(open(filename, "w"))
def substitute(self, argv):
if argv[0] in self:
oldargv = argv[1:]
argv = shlex.split(self[argv[0]])
argv.extend(oldargv)
return argv
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment