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): ...@@ -112,10 +112,8 @@ class Cli(object):
if len(argv) == 0: if len(argv) == 0:
continue continue
# alias subsitution # alias subsitution
if argv[0] in self.aliases: argv = self.aliases.substitute(argv)
oldargv = argv[1:] # command execution
argv = shlex.split(self.aliases[argv[0]])
argv.extend(oldargv)
self._exec_command(argv) self._exec_command(argv)
except KeyboardInterrupt: except KeyboardInterrupt:
self.printer.out("") self.printer.out("")
......
...@@ -7,6 +7,7 @@ CloudControl CLI commands module ...@@ -7,6 +7,7 @@ CloudControl CLI commands module
import re import re
import ConfigParser import ConfigParser
import os import os
import shlex
from cccli.exception import * from cccli.exception import *
from cccli.command import * from cccli.command import *
...@@ -98,3 +99,10 @@ class Aliases(dict): ...@@ -98,3 +99,10 @@ class Aliases(dict):
for n,v in self.items(): for n,v in self.items():
fparser.set("alias", n, v) fparser.set("alias", n, v)
fparser.write(open(filename, "w")) 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