Skip to content

Commit

Permalink
fix(outdated): respect --quiet flag for hints (#27317)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju authored Dec 10, 2024
1 parent 21a9e2d commit 7bab83d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cli/tools/registry/pm/outdated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,14 @@ fn print_outdated_table(packages: &[OutdatedPackage]) {
println!("└{package_fill}┴{current_fill}┴{update_fill}┴{latest_fill}┘",);
}

#[allow(clippy::print_stdout)]
fn print_suggestion(compatible: bool) {
println!();
log::info!("");
let (cmd, txt) = if compatible {
("", "compatible")
} else {
(" --latest", "available")
};
println!(
log::info!(
"{}",
color_print::cformat!(
"<p(245)>Run</> <u>deno outdated --update{}</> <p(245)>to update to the latest {} versions,</>\n<p(245)>or</> <u>deno outdated --help</> <p(245)>for more information.</>",
Expand Down
5 changes: 5 additions & 0 deletions tests/specs/update/deno_json/__test__.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
{
"args": "outdated",
"output": "outdated.out"
},
{
// Respect `--quiet flag and don't print hint how to update
"args": "outdated --quiet",
"output": "outdated_quiet.out"
}
]
},
Expand Down
15 changes: 15 additions & 0 deletions tests/specs/update/deno_json/outdated_quiet.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
┌────────────────────────────────────────────────┬─────────┬────────┬────────┐
│ Package │ Current │ Update │ Latest │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ jsr:@denotest/multiple-exports │ 0.2.0 │ 0.2.0 │ 1.0.0 │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ jsr:@denotest/subtract │ 0.2.0 │ 0.2.0 │ 1.0.0 │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ jsr:@denotest/add │ 0.2.0 │ 0.2.1 │ 1.0.0 │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ npm:@denotest/has-patch-versions │ 0.1.0 │ 0.1.1 │ 0.2.0 │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ npm:@denotest/bin │ 0.6.0 │ 0.6.0 │ 1.0.0 │
├────────────────────────────────────────────────┼─────────┼────────┼────────┤
│ npm:@denotest/breaking-change-between-versions │ 1.0.0 │ 1.0.0 │ 2.0.0 │
└────────────────────────────────────────────────┴─────────┴────────┴────────┘

0 comments on commit 7bab83d

Please sign in to comment.