From 3a87ba492d34e9e526cbadfb1c42f899fa082738 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 29 Dec 2023 15:52:59 -0800 Subject: [PATCH 1/2] Add `--format` and `--initialize` aliases for `--fmt` and `--init` --- src/config.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config.rs b/src/config.rs index 1c20aee7de..c9e52d6549 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( From 934e8a81d12e3100078628da0c9328c11fb51931 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 29 Dec 2023 15:54:13 -0800 Subject: [PATCH 2/2] Tweak --- src/config.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/config.rs b/src/config.rs index c9e52d6549..d5685856e0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1428,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"], @@ -1438,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"],