MCPcopy Create free account
hub / github.com/StanfordPL/stoke / write_cmd

Method write_cmd

tools/scripts/completion_generator.py:96–109  ·  view source on GitHub ↗
(self, command, depth)

Source from the content-addressed store, hash-verified

94 self.writeln("complete -F _stoke stoke")
95
96 def write_cmd(self, command, depth):
97 comps = []
98 if command.has_subcommands():
99 for sub in command.subcommands:
100 comps.append(sub.name)
101 else:
102 for arg in command.arguments:
103 for param in arg.params:
104 comps.append(param)
105
106 self.writeln(" if [ $COMP_CWORD -eq " + str(depth) + " -a $prev == " + command.name + " ]")
107 self.writeln(" then")
108 self.writeln(" COMPREPLY=( $(compgen -W \"" + " ".join(comps) + "\" -- $cur) )")
109 self.writeln(" fi")
110
111 def finish(self):
112 super(BashHandler, self).finish()

Callers 1

auxMethod · 0.95

Calls 2

has_subcommandsMethod · 0.80
writelnMethod · 0.80

Tested by

no test coverage detected