这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: specific error message for potential debugging flags #10513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
#[clap(
short = 'v',
Expand Down
2 changes: 2 additions & 0 deletions crates/turborepo-lib/src/shim/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
14 changes: 14 additions & 0 deletions crates/turborepo-lib/src/shim/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion turborepo-tests/integration/tests/no-args.t
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Make sure exit code is 2 when no args are passed
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down
12 changes: 6 additions & 6 deletions turborepo-tests/integration/tests/turbo-help.t
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Test help flag
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down Expand Up @@ -201,7 +201,7 @@ Test help flag
Specify a file to save a pprof trace

--verbosity <COUNT>
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`.
Expand Down Expand Up @@ -368,7 +368,7 @@ Test help flag for link command
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down Expand Up @@ -416,7 +416,7 @@ Test help flag for unlink command
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down Expand Up @@ -468,7 +468,7 @@ Test help flag for login command
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down Expand Up @@ -516,7 +516,7 @@ Test help flag for logout command
--trace <TRACE>
Specify a file to save a pprof trace
--verbosity <COUNT>
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 <ROOT_TURBO_JSON>
Expand Down
Loading