5. pypsi.completers - Core tab completion functions

Builtin tab completion functions.

pypsi.completers.choice_completer(choices, case_sensitive=False)[source]

Tab complete from a list of choices.

Parameters:
  • choices (list) – the list of choices
  • case_sensitive (bool) – whether the choices are case sensitive
pypsi.completers.command_completer(parser, shell, args, prefix, case_sensitive=False)[source]

Completion function that can tab complete options, options’ values, and positional parameters. Shell, args, and prefix should be the same params as passed to the pypsi.core.Command.complete() function

Parameters:
  • parser – A PypsiArgParser object or an action object returned from PypsiArgParser.add_subparsers()
  • shell (pypsi.shell.Shell) – The current Shell object
  • args (list) – The full list of current CLI args
  • prefix (str) – The partial arg being completed
  • case_sensitive (bool) – Whether the prefix will be completed in a case sensitive manner
Return list:

A list of possible options based on the prefix