friendlyshell.command_complete_mixin module

Mixin class that adds command completion to a friendly shell

class friendlyshell.command_complete_mixin.CommandCompleteMixin(*args, **kwargs)[source]

Bases: object

Mixin to be added to any friendly shell to add command completion

do_clear_history()[source]

Clears the history of previously used commands from this shell

friendlyshell.command_complete_mixin.auto_complete_manager(*args, **kwds)[source]

Context manager for enabling command line auto-completion

This context manager can be used to ensure that command completion for a Friendly Shell runner can have it’s own self-defined auto-completion and command history while not affecting the global completion sub-system that may already be configured prior to running the Friendly Shell. Through the use of a context manager, we ensure the state of the command completion subsystem will be restored regardless of how the context manager was terminated.

Parameters:
  • key (str) – descriptor for keyboard key to use for auto completion trigger
  • callback – method point for the callback to run when completion key is pressed
  • history_file (str) – optional path to the history file to use for storing previous commands run by this shell. If not provided, history will not be saved.