Interactive shell API¶
Interactive CLI shell, independent of network domain logic.
- nadzoring.shell.start_interactive(ctx: Context, _param: Parameter, value: bool) None[source]¶
Start the shell for Click’s eager interactive option.
- Parameters:
ctx – Root Click context.
_param – Interactive option definition.
value – Whether the option was supplied.
Command dispatch¶
Parse and dispatch interactive commands through the existing CLI.
- class nadzoring.shell.session.ShellSession(command: Group, output: str | None = None)[source]¶
Interactive command dispatcher with a session-local output default.
commandis the existing root Click group.outputis the session default, or None to use normal CLI defaults.- _defaults(command: Command) dict[str, Any][source]¶
Build nested Click defaults without changing command definitions.
- _dispatch(args: list[str]) bool[source]¶
Handle shell built-ins or invoke Click without terminating the process.
- command: Group¶
- execute(line: str) bool[source]¶
Execute one shell line, returning False only for exit or quit.
- Parameters:
line – Command line with shell-style quoting (not shell expansion).
- Returns:
Whether the interactive session should continue.
- output: str | None = None¶
Click completion¶
Interactive completion backed by Click’s existing command tree.
- nadzoring.shell.completion._output_choices(command: Command) list[str][source]¶
Find output formats in the existing Click option definitions.
- nadzoring.shell.completion.complete_line(command: Group, text: str) tuple[list[str], str][source]¶
Return completion candidates and the partial word before the cursor.
- Parameters:
command – Root CLI group.
text – Input before the cursor, including any trailing whitespace.
- Returns:
Candidate values and the word they replace.
- nadzoring.shell.completion.completion_items(command: Group, text: str) tuple[list[CompletionItem], str][source]¶
Return Click candidates with descriptions and the replacement suffix.
- Parameters:
command – Root CLI group.
text – Input before the cursor.
- Returns:
Completion items and the partial value to replace.
Terminal backends¶
Optional terminal backends with a shared, plain-text command history.
- nadzoring.shell.terminal._fallback_input(command: Group, history: list[str]) Generator[Callable[[], str]][source]¶
Configure readline when available, otherwise use bare input.