cli: don't search rule in apis, filter apis that start with that rule

Search verb in apis takes more time than filtering out apis that start with
that verb from the grammar.

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2012-11-05 18:13:35 +05:30
parent 46ad8d6f4e
commit 49b4786de6

View File

@ -295,7 +295,7 @@ def main():
self = CloudStackShell
for rule in grammar:
setattr(self, 'completions_' + rule, map(lambda x: x.replace(rule, ''),
filter(lambda x: rule in x,
filter(lambda x: x.startswith(rule),
completions)))
def add_grammar(rule):