Files
computer-playbook/cli/console/__main__.py
kevinveenbirkenbach 2ae4aaeac0 feat(cli.console): short-circuit --help before loading the REPL
`python -m cli.console -h` and `--help` now print a local usage
summary and exit without importing `cli.console.repl`. The
description covers the wrapper's behaviour (prefix stripping,
help-alias handling, Ctrl+C semantics, exit tokens) so callers can
discover the REPL surface without entering it.

The repl import is moved into the run branch so the help path
stays cheap and free of repl-side imports.
2026-05-21 17:05:42 +02:00

23 lines
634 B
Python

"""Interactive REPL for the infinito.nexus CLI (runs on the host)."""
from __future__ import annotations
import sys
def _print_help() -> None:
print("usage: infinito console")
print()
print("Interactive REPL that forwards each line to the infinito CLI.")
print("Strips a leading 'infinito'/'cli' prefix, treats 'help'/'?' as --help,")
print("ignores Ctrl+C; exits on 'exit', 'quit', ':q', or Ctrl+D.")
if __name__ == "__main__":
if any(arg in ("-h", "--help") for arg in sys.argv[1:]):
_print_help()
raise SystemExit(0)
from cli.console.repl import main
raise SystemExit(main())