fix(cli): respect -q flag in mise prepare command#8792
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces custom miseprintln! macros with standard logging macros such as info! and warn! within the prepare command. The feedback suggests using error! instead of warn! for failed steps to ensure that failure messages remain visible even when the log level is restricted, such as in quiet mode.
Greptile SummaryThis PR fixes the Key changes:
Confidence Score: 5/5Safe to merge — the fix is narrowly scoped and correct, and the e2e tests are consistently updated to capture stderr output. No P0/P1 issues identified that were not already discussed in prior review threads. The use of error!() for Failed steps ensures failures are visible even in quiet mode (quiet sets log_level to 'error', not 'off'), addressing the main concern from the previous thread. All e2e tests correctly add 2>&1 to capture the now-stderr output from the logging macros. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["mise prepare run()"] --> B{Check result steps}
B -->|PrepareStepResult::Ran| C["info!('Prepared: {id}')"]
B -->|PrepareStepResult::WouldRun| D["info!('[dry-run] Would prepare: {id} ({reason})')"]
B -->|PrepareStepResult::Fresh| E["debug!('Fresh: {id}')"]
B -->|PrepareStepResult::Skipped| F["debug!('Skipped: {id}')"]
B -->|PrepareStepResult::Failed| G["error!('Failed: {id}')"]
C --> H{All steps done?}
D --> H
E --> H
F --> H
G --> H
H -->|!had_work && !dry_run| I["info!('All dependencies are up to date')"]
H -->|otherwise| J["return Ok(())"]
I --> J
subgraph Logger["logger.rs (term_level)"]
K["quiet=true → log_level='error'"]
L["info! filtered out"]
M["error! shown on stderr"]
end
C -.->|routed through| Logger
D -.->|routed through| Logger
G -.->|routed through| Logger
I -.->|routed through| Logger
Reviews (4): Last reviewed commit: "test: update e2e prepare tests" | Re-trigger Greptile |
### 🚀 Features - **(install)** add per-tool install_before option by @sargunv-headway in [#8842](#8842) ### 🐛 Bug Fixes - **(cli)** respect `-q` flag in `mise prepare` command by @Marukome0743 in [#8792](#8792) - fall back to compile-time musl detection when no system linker found by @davireis in [#8825](#8825) ### 📚 Documentation - fix GitHub capitalization in Alpine docs by @Rohan5commit in [#8844](#8844) ### 📦 Registry - add dbt-fusion ([aqua:getdbt.com/dbt-fusion](https://github.com/getdbt.com/dbt-fusion)) by @ryan-pip in [#8837](#8837) ### New Contributors - @Marukome0743 made their first contribution in [#8792](#8792) - @sargunv-headway made their first contribution in [#8842](#8842) - @Rohan5commit made their first contribution in [#8844](#8844) - @ryan-pip made their first contribution in [#8837](#8837) - @rndmh3ro made their first contribution in [#8839](#8839) ## 📦 Aqua Registry Updates #### New Packages (1) - [`azu/dockerfile-pin`](https://github.com/azu/dockerfile-pin) #### Updated Packages (4) - [`anthropics/claude-code`](https://github.com/anthropics/claude-code) - [`dandavison/delta`](https://github.com/dandavison/delta) - [`goreleaser/goreleaser`](https://github.com/goreleaser/goreleaser) - [`zellij-org/zellij`](https://github.com/zellij-org/zellij)
Summary
The global
-q(--quiet) flag was not suppressing status messages inmise prepare.This is because the command used
miseprintln!()for result reporting, which writesdirectly to stdout and bypasses the logging system entirely.
Problem
When running
mise prepare -q, messages like the following were still printed:Prepared: <provider>[dry-run] Would prepare: <provider> (<reason>)Failed: <provider>All dependencies are up to dateIn contrast,
mise install -qcorrectly suppresses all non-error output because it usesinfo!()/warn!()macros that go through the logger, which checksSettings::quietand sets
log_levelto"error"accordingly.Root Cause
miseprintln!()expands tocalm_io::stdoutln!()and has no awareness of the quiet flag.The logging macros (
info!(),warn!(),debug!()) route through the logger insrc/logger.rs, which respects theterm_levelderived fromSettings::quiet.Changes
In
src/cli/prepare.rs, replacedmiseprintln!()with appropriate logging macros in therun()method's result reporting section:Prepared: {id}miseprintln!info![dry-run] Would prepare: ...miseprintln!info!Failed: {id}miseprintln!error!All dependencies are up to datemiseprintln!info!The
--explainand--listsubcommand outputs remain usingmiseprintln!()intentionally,since those are explicitly requested by the user and should always be displayed regardless
of the
-qflag.