From 0c84652cc5c67f2cbe0977c84eff641e30a1322f Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 15 Jul 2025 12:00:07 -0500 Subject: [PATCH] [ty] Allow `-q` short alias for `--quiet` (#19364) --- crates/ty/docs/cli.md | 2 +- crates/ty/src/logging.rs | 1 + crates/ty/tests/cli/main.rs | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/ty/docs/cli.md b/crates/ty/docs/cli.md index efe141813e..8ffd58cc6d 100644 --- a/crates/ty/docs/cli.md +++ b/crates/ty/docs/cli.md @@ -84,7 +84,7 @@ over all configuration files.

  • 3.11
  • 3.12
  • 3.13
  • -
    --quiet

    Use quiet output

    +
    --quiet, -q

    Use quiet output

    --respect-ignore-files

    Respect file exclusions via .gitignore and other standard ignore files. Use --no-respect-gitignore to disable

    --typeshed, --custom-typeshed-dir path

    Custom directory to use for stdlib typeshed stubs

    --verbose, -v

    Use verbose output (or -vv and -vvv for more verbose output)

    diff --git a/crates/ty/src/logging.rs b/crates/ty/src/logging.rs index a85d527a47..a67511c7c9 100644 --- a/crates/ty/src/logging.rs +++ b/crates/ty/src/logging.rs @@ -30,6 +30,7 @@ pub(crate) struct Verbosity { #[arg( long, + short, help = "Use quiet output", action = clap::ArgAction::Count, global = true, diff --git a/crates/ty/tests/cli/main.rs b/crates/ty/tests/cli/main.rs index 14c237a729..67fb9b0122 100644 --- a/crates/ty/tests/cli/main.rs +++ b/crates/ty/tests/cli/main.rs @@ -69,6 +69,26 @@ fn test_quiet_output() -> anyhow::Result<()> { ----- stderr ----- "); + // We allow `-q` + assert_cmd_snapshot!(case.command().arg("-q"), @r" + success: false + exit_code: 1 + ----- stdout ----- + Found 1 diagnostic + + ----- stderr ----- + "); + + // And repeated `-qq` + assert_cmd_snapshot!(case.command().arg("-qq"), @r" + success: false + exit_code: 1 + ----- stdout ----- + Found 1 diagnostic + + ----- stderr ----- + "); + Ok(()) }