diff --git a/crates/turborepo-lib/src/cli/mod.rs b/crates/turborepo-lib/src/cli/mod.rs index 6b6ed2531bace..81339812a1059 100644 --- a/crates/turborepo-lib/src/cli/mod.rs +++ b/crates/turborepo-lib/src/cli/mod.rs @@ -277,7 +277,8 @@ pub struct Verbosity { conflicts_with = "v", value_name = "COUNT" )] - /// Verbosity level + /// Verbosity level. Useful when debugging Turborepo or creating logs for + /// issue reports pub verbosity: Option, #[clap( short = 'v', diff --git a/crates/turborepo-lib/src/shim/mod.rs b/crates/turborepo-lib/src/shim/mod.rs index 779e79933e250..3f99f51980ebd 100644 --- a/crates/turborepo-lib/src/shim/mod.rs +++ b/crates/turborepo-lib/src/shim/mod.rs @@ -53,6 +53,8 @@ pub enum Error { #[label = "Requires a path to be passed after it"] flag_range: SourceSpan, }, + #[error("The {flag} flag is not supported. {suggestion}")] + UnsupportedFlag { flag: String, suggestion: String }, #[error(transparent)] #[diagnostic(transparent)] Cli(#[from] cli::Error), diff --git a/crates/turborepo-lib/src/shim/parser.rs b/crates/turborepo-lib/src/shim/parser.rs index 9d88f972406e9..35dab11fdd5b5 100644 --- a/crates/turborepo-lib/src/shim/parser.rs +++ b/crates/turborepo-lib/src/shim/parser.rs @@ -142,6 +142,20 @@ impl ShimArgs { // `--root-turbo-json=./path/to/turbo.json`, that entire chunk // is a single arg, so we need to split it up. root_turbo_json = Some(AbsoluteSystemPathBuf::from_unknown(&invocation_dir, path)); + } else if arg == "--debug" { + return Err(Error::UnsupportedFlag { + flag: "--debug".to_string(), + suggestion: "Please use --verbosity instead.\n if you are trying to pass \ + `--debug` as a value, use `-- --debug`." + .to_string(), + }); + } else if arg == "--verbose" { + return Err(Error::UnsupportedFlag { + flag: "--verbose".to_string(), + suggestion: "Please use --verbosity instead.\n if you are trying to pass \ + `--verbose` as a value, use `-- --verbose`." + .to_string(), + }); } else { remaining_turbo_args.push(arg); } diff --git a/turborepo-tests/integration/tests/no-args.t b/turborepo-tests/integration/tests/no-args.t index d8f26d6027387..f78b2cadbef97 100644 --- a/turborepo-tests/integration/tests/no-args.t +++ b/turborepo-tests/integration/tests/no-args.t @@ -57,7 +57,7 @@ Make sure exit code is 2 when no args are passed --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json diff --git a/turborepo-tests/integration/tests/turbo-help.t b/turborepo-tests/integration/tests/turbo-help.t index 6c399ef52611c..39663df7de4f9 100644 --- a/turborepo-tests/integration/tests/turbo-help.t +++ b/turborepo-tests/integration/tests/turbo-help.t @@ -57,7 +57,7 @@ Test help flag --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json @@ -201,7 +201,7 @@ Test help flag Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json`. @@ -368,7 +368,7 @@ Test help flag for link command --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json @@ -416,7 +416,7 @@ Test help flag for unlink command --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json @@ -468,7 +468,7 @@ Test help flag for login command --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json @@ -516,7 +516,7 @@ Test help flag for logout command --trace Specify a file to save a pprof trace --verbosity - Verbosity level + Verbosity level. Useful when debugging Turborepo or creating logs for issue reports --dangerously-disable-package-manager-check Allow for missing `packageManager` in `package.json` --root-turbo-json