Warn that --output / --format are ignored under --tui (#220)#241
Conversation
In TUI mode, --output and --format had no effect and emitted no warning: run_session_browser never receives them, and the TUI's export actions write to a fixed per-session path. Now the CLI warns (to stderr) when either is passed with --tui, mirroring the existing --expand-paths / --filter-path ignored-flag warnings. An explicit -f is detected via the Click parameter source so the html default doesn't false-trigger. Also gate the #222 format-inference/conflict block on `not tui`: those flags are no-ops under --tui (now warned), so erroring on a `-o x.md -f html` conflict there would contradict the warning and block the TUI from launching. Under --tui we warn and proceed. This is the minimal half of #220; an in-app "export to path" action is a possible follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThe CLI now warns when ChangesTUI output flag warnings
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/test_tui_output_warn.py`:
- Around line 90-91: The non-TUI baseline test using self.runner.invoke(main,
[str(src), "-o", str(out)]) only checks output and can miss failures, so update
this test to also assert r.exit_code == 0 after invoking main; keep the existing
output assertion alongside it so the test validates both successful execution
and the expected TUI-related message behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ef284442-9f42-4f26-825c-18c0affab07b
📒 Files selected for processing (2)
claude_code_log/cli.pytest/test_tui_output_warn.py
| r = self.runner.invoke(main, [str(src), "-o", str(out)]) | ||
| assert "ignored in --tui mode" not in r.output |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add an exit-code assertion in the non-TUI baseline test.
Line 90 should also assert r.exit_code == 0; otherwise this test can pass even when invocation fails for unrelated reasons.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/test_tui_output_warn.py` around lines 90 - 91, The non-TUI baseline test
using self.runner.invoke(main, [str(src), "-o", str(out)]) only checks output
and can miss failures, so update this test to also assert r.exit_code == 0 after
invoking main; keep the existing output assertion alongside it so the test
validates both successful execution and the expected TUI-related message
behavior.
The last of the
--output/--format/ TUI group (#220–#223). #221/#222/#223-pt1 landed in #237; #223-pt2 in #239.Problem
In
--tuimode,--outputand--formatwere silently ignored — no effect, no warning.run_session_browsernever receives them, and the TUI's export actions write to a fixed per-session path. A user runningclaude-code-log --tui --format markdown --output log.mdgot nolog.mdand no indication why.Fix (minimal)
Warn (to stderr) when
--outputor--formatis passed with--tui, mirroring the existing--expand-paths/--filter-pathignored-flag warnings. An explicit-fis detected via the Click parameter source, so thehtmldefault doesn't false-trigger.Also gate the #222 format-inference/conflict block (added in #237) on
not tui: those flags are no-ops under--tui, so hard-erroring on a-o x.md -f htmlconflict there would contradict the warning and block the TUI from launching. Under--tuiwe warn and proceed; the non-TUI conflict error is unchanged.The in-app "export to path" action (the other half of #220) is intentionally deferred — left for a follow-up once this minimal warn lands.
Tests
test/test_tui_output_warn.py(6): warn on-o/explicit--funder--tui; no warn without them; warn on stderr not stdout; no warn for non-TUI-o; and-o x.md -f html --tuiwarns-and-proceeds (no conflict error). Driven via an empty--projects-dirso the TUI returns early without launching Textual — runs in the fast unit suite.just cigreen.Closes #220
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests