From fc25a78826934983921ed970a2d5e431ba528315 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 29 Dec 2023 15:56:20 -0800 Subject: [PATCH] Add `--format` and `--initialize` as aliases for `--fmt` and `--init` (#1802) --- src/config.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/config.rs b/src/config.rs index 1c20aee..d568585 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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"],