Remove --check alias introduced in eda2be63

We do not want to support the --{subcommand} legacy format for new
subcommands ... only for subcommands that used this format previously.
This commit is contained in:
Martin Fischer
2023-01-28 04:12:37 +01:00
committed by Charlie Marsh
parent caada2f8bb
commit ff3563b8ce

View File

@@ -41,11 +41,7 @@ fn inner_main() -> Result<ExitCode> {
// default for convenience and backwards-compatibility, so we just
// preprocess the arguments accordingly before passing them to Clap.
if let Some(arg) = args.get(1).and_then(|s| s.to_str()) {
if !Command::has_subcommand(arg)
&& !arg
.strip_prefix("--")
.map(Command::has_subcommand)
.unwrap_or_default()
if !Command::has_subcommand(rewrite_legacy_subcommand(arg))
&& arg != "-h"
&& arg != "--help"
&& arg != "-v"
@@ -274,6 +270,15 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitCode> {
Ok(ExitCode::SUCCESS)
}
fn rewrite_legacy_subcommand(cmd: &str) -> &str {
match cmd {
"--explain" => "explain",
"--clean" => "clean",
"--generate-shell-completion" => "generate-shell-completion",
cmd => cmd,
}
}
#[must_use]
pub fn main() -> ExitCode {
match inner_main() {