Add --format and --initialize as aliases for --fmt and --init (#1802)

This commit is contained in:
Casey Rodarmor 2023-12-29 15:56:20 -08:00 committed by GitHub
parent f3b103a2e0
commit fc25a78826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -345,11 +345,13 @@ impl Config {
.arg(
Arg::with_name(cmd::FORMAT)
.long("fmt")
.alias("format")
.help("Format and overwrite justfile"),
)
.arg(
Arg::with_name(cmd::INIT)
.long("init")
.alias("initialize")
.help("Initialize new justfile in project root"),
)
.arg(
@ -1426,6 +1428,16 @@ mod tests {
},
}
error! {
name: fmt_alias,
args: ["--format", "bar"],
error: ConfigError::SubcommandArguments { subcommand, arguments },
check: {
assert_eq!(subcommand, cmd::FORMAT);
assert_eq!(arguments, &["bar"]);
},
}
error! {
name: init_arguments,
args: ["--init", "bar"],
@ -1436,6 +1448,16 @@ mod tests {
},
}
error! {
name: init_alias,
args: ["--initialize", "bar"],
error: ConfigError::SubcommandArguments { subcommand, arguments },
check: {
assert_eq!(subcommand, cmd::INIT);
assert_eq!(arguments, &["bar"]);
},
}
error! {
name: show_arguments,
args: ["--show", "foo", "bar"],