Help Command API Reference¶
This section documents the internals of the help
command in Bijux CLI.
bijux_cli.commands.help ¶
Implements the help
command for the Bijux CLI.
This module provides a contextual help system that can generate and display help text for any command or subcommand. It supports multiple output formats, including human-readable text for interactive use and structured JSON or YAML for automation and integration purposes. It also includes special logic to suppress known noisy warnings from the plugin system during help generation.
Output Contract
- Human: Standard CLI help text is printed to stdout.
- JSON/YAML:
{"help": str}
- Verbose: Adds
{"python": str, "platform": str, "runtime_ms": int}
. - Error:
{"error": str, "code": int}
Exit Codes
0
: Success.1
: Fatal or internal error.2
: CLI argument, flag, or "command not found" error.3
: ASCII or encoding error.
help_callback ¶
help_callback(
ctx: Context,
command_path: list[str] | None = ARGS,
quiet: bool = Option(
False, "-q", "--quiet", help=HELP_QUIET
),
verbose: bool = Option(
False, "-v", "--verbose", help=HELP_VERBOSE
),
fmt: str = Option(
_HUMAN, "-f", "--format", help=HELP_FORMAT_HELP
),
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 help
command.
This function orchestrates the entire help generation process. It parses the target command path, finds the corresponding command object, performs ASCII and format validation, and emits the help text in the specified format.
Parameters:
-
ctx
(Context
) –The Typer context for the CLI.
-
command_path
(list[str] | None
, default:ARGS
) –A list of tokens representing the path to the target command (e.g.,
["config", "get"]
). -
quiet
(bool
, default:Option(False, '-q', '--quiet', help=HELP_QUIET)
) –If True, suppresses all output. The exit code is the primary indicator of outcome.
-
verbose
(bool
, default:Option(False, '-v', '--verbose', help=HELP_VERBOSE)
) –If True, includes Python and platform details in structured output formats.
-
fmt
(str
, default:Option(_HUMAN, '-f', '--format', help=HELP_FORMAT_HELP)
) –The output format: "human", "json", or "yaml".
-
pretty
(bool
, default:Option(True, '--pretty/--no-pretty', help=HELP_NO_PRETTY)
) –If True, pretty-prints structured output.
-
debug
(bool
, default:Option(False, '-d', '--debug', help=HELP_DEBUG)
) –If True, enables debug diagnostics, implying
verbose
andpretty
.
Returns:
-
None
(None
) –
Raises:
-
SystemExit
–Always exits with a contract-compliant exit code and payload upon completion or error.
Source code in src/bijux_cli/commands/help.py
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 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
|