Status Command API Reference¶
This section documents the internals of the status
command in Bijux CLI.
bijux_cli.commands.status ¶
Implements the status
command for the Bijux CLI.
This module provides a lightweight "liveness probe" for the CLI, designed for health checks and monitoring. In its default mode, it performs a quick check and returns a simple "ok" status. It also supports a continuous "watch" mode that emits status updates at a regular interval.
Output Contract
- Success:
{"status": "ok"}
- Verbose: Adds
{"python": str, "platform": str}
to the payload. - Watch Mode Tick:
{"status": "ok", "ts": float, ...}
- Watch Mode Stop:
{"status": "watch-stopped", ...}
- Error:
{"error": str, "code": int}
Exit Codes
0
: Success.1
: Internal or fatal error during execution.2
: Invalid argument (e.g., bad watch interval or format).3
: ASCII encoding error.
status ¶
status(
ctx: Context,
watch: float | None = Option(
None, "--watch", help="Poll every N seconds"
),
quiet: bool = Option(
False, "-q", "--quiet", help=HELP_QUIET
),
verbose: bool = Option(
False, "-v", "--verbose", help=HELP_VERBOSE
),
fmt: str = Option(
"json", "-f", "--format", help=HELP_FORMAT
),
pretty: bool = Option(
True, "--pretty/--no-pretty", help=HELP_NO_PRETTY
),
debug: bool = Option(
False, "-d", "--debug", help=HELP_DEBUG
),
) -> None
Defines the entrypoint and logic for the bijux status
command.
This function orchestrates the status check. It validates flags and then dispatches to either the single-run logic or the continuous watch mode based on the presence of the --watch
flag.
Parameters:
-
ctx
(Context
) –The Typer context for the CLI.
-
watch
(float | None
, default:Option(None, '--watch', help='Poll every N seconds')
) –If provided, enters watch mode, polling at this interval in seconds. Must be a positive number.
-
quiet
(bool
, default:Option(False, '-q', '--quiet', help=HELP_QUIET)
) –If True, suppresses all output except for errors.
-
verbose
(bool
, default:Option(False, '-v', '--verbose', help=HELP_VERBOSE)
) –If True, includes Python and platform details in the output payload.
-
fmt
(str
, default:Option('json', '-f', '--format', help=HELP_FORMAT)
) –The output format, either "json" or "yaml". Watch mode only supports "json".
-
pretty
(bool
, default:Option(True, '--pretty/--no-pretty', help=HELP_NO_PRETTY)
) –If True, pretty-prints the output for human readability.
-
debug
(bool
, default:Option(False, '-d', '--debug', help=HELP_DEBUG)
) –If True, enables debug diagnostics, implying
verbose
andpretty
.
Returns:
-
None
(None
) –
Raises:
-
SystemExit
–Exits with a contract-compliant status code and payload upon any error, such as an invalid watch interval.
Source code in src/bijux_cli/commands/status.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|