Skip to content

Commit

Permalink
Add --format and --initialize as aliases for --fmt and --init (
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Dec 29, 2023
1 parent f3b103a commit fc25a78
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down

0 comments on commit fc25a78

Please sign in to comment.