saturnin._scripts.repl¶
REPL for Typer application
Globals¶
- saturnin._scripts.repl.kb¶
Prompt-toolkit key bindings
Classes¶
- class saturnin._scripts.repl.CustomClickCompleter(cli)[source]¶
Bases:
Completer
Custom prompt-toolkit completer.
It provides command completion for Typer/Click commands and parameters, including option/parameter values.
- Parameters:
cli – Root Typer command group
- class saturnin._scripts.repl.IOManager(context, *, echo: Callable[[str], None] | None = None, console: Console = None)[source]¶
Bases:
object
REPL I/O manager.
Handles command prompt, stdin/stdout redirection etc.
- Parameters:
context – Current Click context
echo (Optional[EchoCallback]) – Callback called with command line before it’s executed.
console (Console) – Costom Rich console for output. If not provided, Saturnin standard console is used.
- _get_command() str [source]¶
Returns next command fetched from queue, stdin or console prompt.
- Return type:
Functions¶
- saturnin._scripts.repl.repl(context, ioman: IOManager) bool [source]¶
Start an interactive shell. All subcommands are available in it.
- Parameters:
context – Current Click context.
ioman (IOManager) – IOManager instance.
- Returns:
True if REPL should be restarted, otherwise returns False.
- Return type:
If stdin is not a TTY, no prompt will be printed, but commands are read from stdin.