def complete( self, line: xcli.Annotated["list[str]", xcli.Arg(nargs="...")], prefix: "str | None" = None, ): """Output the completions to stdout Parameters ---------- line pass the CLI arguments as if they were typed prefix : -p, --prefix word at cursor Examples -------- To get completions such as `git checkout` $ completer complete --prefix=check git """ from xonsh.completer import Completer completer = Completer() completions, prefix_length = completer.complete_line(" ".join(line), prefix=prefix) self.out(f"Prefix Length: {prefix_length}") for comp in completions: self.out(repr(comp))
def complete( self, line: str, ): """Output the completions to stdout Parameters ---------- line pass the CLI arguments as if they were typed prefix : -p, --prefix word at cursor Examples -------- To get completions such as ``pip install`` $ completer complete 'pip in' To get ``pip`` sub-commands, pass the command with a space at the end $ completer complete 'pip ' """ from xonsh.completer import Completer completer = Completer() completions, prefix_length = completer.complete_line(line) self.out(f"Prefix Length: {prefix_length}") for comp in completions: self.out(repr(comp))