Add CLI options to disable exports#48
Hidden character warning
Conversation
WalkthroughTwo new command-line flags, Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/test_cli.py (1)
36-46: Consider adding mixed scenario tests for better coverage.The current tests cover the two extremes (all exports enabled vs. all disabled) but don't test mixed scenarios where only one export is disabled.
Consider adding these test cases to improve coverage:
+def test_cli_disable_markdown_only(monkeypatch, tmp_path): + calls = _run_cli(monkeypatch, tmp_path, ["--no-markdown"]) + assert calls["md"] is False + assert calls["json"] is True + + +def test_cli_disable_json_only(monkeypatch, tmp_path): + calls = _run_cli(monkeypatch, tmp_path, ["--no-json"]) + assert calls["md"] is True + assert calls["json"] is False
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crawler_to_md/cli.py(3 hunks)tests/test_cli.py(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
crawler_to_md/cli.py (1)
crawler_to_md/export_manager.py (2)
export_to_markdown(100-110)export_to_json(112-137)
🔇 Additional comments (4)
crawler_to_md/cli.py (3)
91-102: LGTM! Clean implementation of the CLI flags.The new command-line arguments are properly defined with clear help text and appropriate defaults. The implementation follows the existing pattern in the codebase.
189-195: LGTM! Conditional export logic is correct.The implementation properly checks the negation of the flags before executing the export methods. This ensures that exports are only performed when the corresponding flags are not set.
207-210: LGTM! Consistent conditional output display.The print statements are appropriately made conditional, ensuring that file paths are only displayed when the corresponding exports actually occur. This provides a better user experience by avoiding confusion about non-existent files.
tests/test_cli.py (1)
7-33: LGTM! Well-structured test helper function.The
_run_clihelper function effectively monkeypatches the necessary methods to avoid actual file operations while tracking whether export methods are called. The approach is clean and follows good testing practices.
Summary
--no-markdownand--no-jsonflagsTesting
pytest -qhttps://chatgpt.com/codex/tasks/task_e_686af837fe20832e93c04535e8b51e9f
Summary by CodeRabbit
--no-markdown) and JSON (--no-json) output files.