fix(cli): stop --print-effective-config from starting a container

argparse requires exactly one action, so the documented diagnostic form
`--print-effective-config --config … --start` never took the early-return
branch in main.run(): it printed the resolved config and then executed a
real do_start(), silently replacing a running container with the [default]
model. README, installation guide and manual all recommended that form.

Make it an action in the mutually exclusive group. It can no longer be
combined with --start/--check/--stop/--change/--chat (argparse error,
exit 2), and it skips the docker_available() check, so it now really is
the offline config check the docs promise. --dry-run remains a modifier
and still requires a reachable daemon.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dieter Schlüter 2026-07-10 16:25:07 +02:00
commit 3e3dd1c150
8 changed files with 104 additions and 30 deletions

View file

@ -147,9 +147,16 @@ def test_dry_run_flag():
assert args.dry_run is True
def test_print_effective_config_flag():
args = parse(["--start", "--print-effective-config"])
def test_print_effective_config_is_a_standalone_action():
args = parse(["--print-effective-config"])
assert args.print_effective_config is True
assert args.start is False
def test_print_effective_config_cannot_be_combined_with_start():
# Regression: as a plain flag this printed the config and then really started
# the container, silently replacing a running one.
parse_error(["--print-effective-config", "--start"])
def test_reasoning_choice_validated():