MCPcopy Create free account
hub / github.com/apache/mesos / autocomplete

Function autocomplete

src/python/cli_new/bin/main.py:53–78  ·  view source on GitHub ↗

Perform autocomplete for the given input arguments. If not completing a top level command (or "help"), this function passes the arguments down to the appropriate plugins for per-plugin autocompletion.

(cmds, plugins, config, argv)

Source from the content-addressed store, hash-verified

51
52
53def autocomplete(cmds, plugins, config, argv):
54 """
55 Perform autocomplete for the given input arguments. If not
56 completing a top level command (or "help"), this function passes
57 the arguments down to the appropriate plugins for per-plugin
58 autocompletion.
59 """
60
61 option = "default"
62 current_word = argv[0]
63 argv = argv[1:]
64
65 if argv and argv[0] == "help":
66 argv = argv[1:]
67
68 comp_words = list(cmds.keys()) + ["help"]
69 comp_words = cli.util.completions(comp_words, current_word, argv)
70 if comp_words is not None:
71 return (option, comp_words)
72
73 plugin = cli.util.get_module(plugins, argv[0])
74 plugin_class = getattr(plugin, plugin.PLUGIN_CLASS)
75
76 return plugin_class(settings, config).__autocomplete_base__(
77 current_word,
78 argv[1:])
79
80
81def main(argv):

Callers 1

mainFunction · 0.85

Calls 3

__autocomplete_base__Method · 0.80
listFunction · 0.50
keysMethod · 0.45

Tested by

no test coverage detected