diff --git a/crates/ty/docs/cli.md b/crates/ty/docs/cli.md
index 4c44f523d7..97a9a1c2d9 100644
--- a/crates/ty/docs/cli.md
+++ b/crates/ty/docs/cli.md
@@ -58,6 +58,8 @@ over all configuration files.
This is an advanced option that should usually only be used for first-party or third-party modules that are not installed into your Python environment in a conventional way. Use --python to point ty to your Python environment if it is in an unusual location.
--help, -hPrint help (see a summary with '-h')
--ignore ruleDisables the rule. Can be specified multiple times.
+--no-progressHide all progress outputs.
+For example, spinners or progress bars.
--output-format output-formatThe format to use for printing diagnostic messages
Possible values:
diff --git a/crates/ty/src/args.rs b/crates/ty/src/args.rs
index f1be98ea46..f6a52a3c8c 100644
--- a/crates/ty/src/args.rs
+++ b/crates/ty/src/args.rs
@@ -34,6 +34,7 @@ pub(crate) enum Command {
}
#[derive(Debug, Parser)]
+#[expect(clippy::struct_excessive_bools)]
pub(crate) struct CheckCommand {
/// List of files or directories to check.
#[clap(
@@ -117,10 +118,6 @@ pub(crate) struct CheckCommand {
#[arg(long)]
pub(crate) output_format: Option,
- /// Control when colored output is used.
- #[arg(long, value_name = "WHEN")]
- pub(crate) color: Option,
-
/// Use exit code 1 if there are any warning-level diagnostics.
#[arg(long, conflicts_with = "exit_zero", default_missing_value = "true", num_args=0..1)]
pub(crate) error_on_warning: Option,
@@ -152,6 +149,21 @@ pub(crate) struct CheckCommand {
/// Supports patterns like `tests/`, `*.tmp`, `**/__pycache__/**`.
#[arg(long, help_heading = "File selection")]
exclude: Option>,
+
+ /// Control when colored output is used.
+ #[arg(
+ long,
+ value_name = "WHEN",
+ help_heading = "Global options",
+ display_order = 1000
+ )]
+ pub(crate) color: Option,
+
+ /// Hide all progress outputs.
+ ///
+ /// For example, spinners or progress bars.
+ #[arg(global = true, long, value_parser = clap::builder::BoolishValueParser::new(), help_heading = "Global options")]
+ pub no_progress: bool,
}
impl CheckCommand {
diff --git a/crates/ty/src/lib.rs b/crates/ty/src/lib.rs
index 66a85870b2..2b28329f3f 100644
--- a/crates/ty/src/lib.rs
+++ b/crates/ty/src/lib.rs
@@ -71,7 +71,7 @@ fn run_check(args: CheckCommand) -> anyhow::Result {
let verbosity = args.verbosity.level();
let _guard = setup_tracing(verbosity, args.color.unwrap_or_default())?;
- let printer = Printer::default().with_verbosity(verbosity);
+ let printer = Printer::new(verbosity, args.no_progress);
tracing::debug!("Version: {}", version::version());
diff --git a/crates/ty/src/printer.rs b/crates/ty/src/printer.rs
index 94c5286d35..1c86095c21 100644
--- a/crates/ty/src/printer.rs
+++ b/crates/ty/src/printer.rs
@@ -12,11 +12,10 @@ pub(crate) struct Printer {
}
impl Printer {
- #[must_use]
- pub(crate) fn with_verbosity(self, verbosity: VerbosityLevel) -> Self {
+ pub(crate) fn new(verbosity: VerbosityLevel, no_progress: bool) -> Self {
Self {
verbosity,
- no_progress: self.no_progress,
+ no_progress,
}
}