From 49b4786de6dada0939e4a26b2cfe0fbae06d8511 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 5 Nov 2012 18:13:35 +0530 Subject: [PATCH] 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 --- tools/cli/cloudmonkey/cloudmonkey.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index 4b282f57790..1cc166c1d65 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -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):