context
¶
| CLASS | DESCRIPTION |
|---|---|
CliContext |
Holds various state and I/O for commands. |
CliContext
dataclass
¶
CliContext(
output_level: OutputLevel,
log: Logger,
console: ConsoleWrapper,
fail_with_usage: Callable[[str], NoReturn],
exit: Callable[[int], NoReturn],
exception_handler: Callable[[CliContext, BaseException], None],
app_dirs: AppDirs = app_dirs,
)
Holds various state and I/O for commands.
| METHOD | DESCRIPTION |
|---|---|
fail |
Aborts the execution of the program with a specific error message. |
| ATTRIBUTE | DESCRIPTION |
|---|---|
exception_handler |
Handle exceptions with this context object.
TYPE:
|
exit |
Exits the application with a given exit code.
TYPE:
|
fail_with_usage |
Aborts the execution of the program with a specific error message and CLI help message.
TYPE:
|
exception_handler
instance-attribute
¶
exception_handler: Callable[[CliContext, BaseException], None]
Handle exceptions with this context object.
exit
instance-attribute
¶
exit: Callable[[int], NoReturn]
Exits the application with a given exit code.
fail_with_usage
instance-attribute
¶
fail_with_usage: Callable[[str], NoReturn]
Aborts the execution of the program with a specific error message and CLI help message.
fail
¶
fail(message: str) -> NoReturn
Aborts the execution of the program with a specific error message.
Source code in nava/platform/cli/context.py
28 29 30 31 | |