Files
obscura/crates
Ben YounesandOra Studio 84115ca06e fix(cli): make --quiet suppress JS console errors on stderr (#56) (#74)
* fix(cli): make --quiet suppress JS console errors on stderr (#56)

The --quiet flag was only gating banner prints in run_fetch but not
the global tracing_subscriber, so ERROR-level JS console output kept
leaking to stderr.

Detect quiet from the parsed Fetch subcommand before initializing
the subscriber and switch the filter to "off" in that case. Verbose
still wins over quiet to keep diagnostic mode usable.

Generated by Ora Studio
Vibe coded by ousamabenyounes

Co-Authored-By: Ora Studio <noreply@oratelecom.net>

* test(cli): add integration tests for --quiet matcher wiring

Address review feedback on PR #74: previous tests only covered the
pure helper select_log_filter, not the matches!() wiring in main()
that maps Command::Fetch { quiet: true, .. } → quiet flag.

Extract the matcher into is_quiet_command(&Option<Command>) and add
six new tests that parse real CLI args via Args::try_parse_from and
assert the full chain:

- parsed_fetch_with_quiet_flag_is_detected: --quiet on fetch → true
- parsed_fetch_without_quiet_is_not_detected: bare fetch → false
- parsed_serve_command_is_not_quiet: serve subcommand → false
- no_subcommand_is_not_quiet: None → false
- parsed_fetch_quiet_resolves_to_off_filter: end-to-end clap → "off"
- matcher_still_uses_fetch_variant: regression guard if Command::Fetch
  variant is renamed/restructured

cargo test -p obscura-cli: 10 passed; 0 failed.

Co-Authored-By: Ora Studio <noreply@oratelecom.net>

---------

Co-authored-by: Ora Studio <noreply@oratelecom.net>
2026-05-09 17:27:03 +02:00
..
2026-04-13 12:30:28 +02:00