diff --git a/cli/src/commands/branch/create.rs b/cli/src/commands/branch/create.rs index 21a23224ff..42cd8ee955 100644 --- a/cli/src/commands/branch/create.rs +++ b/cli/src/commands/branch/create.rs @@ -29,7 +29,7 @@ pub struct BranchCreateArgs { revision: Option, /// The branches to create - #[arg(required = true, value_parser=NonEmptyStringValueParser::new())] + #[arg(required = true, value_parser = NonEmptyStringValueParser::new())] names: Vec, } diff --git a/cli/src/commands/branch/set.rs b/cli/src/commands/branch/set.rs index 5ae50dc699..06b8e0476c 100644 --- a/cli/src/commands/branch/set.rs +++ b/cli/src/commands/branch/set.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use clap::builder::NonEmptyStringValueParser; use jj_lib::object_id::ObjectId as _; use jj_lib::op_store::RefTarget; @@ -32,7 +33,7 @@ pub struct BranchSetArgs { allow_backwards: bool, /// The branches to update - #[arg(required = true)] + #[arg(required = true, value_parser = NonEmptyStringValueParser::new())] names: Vec, } diff --git a/cli/tests/test_branch_command.rs b/cli/tests/test_branch_command.rs index f4d5147469..c706e62485 100644 --- a/cli/tests/test_branch_command.rs +++ b/cli/tests/test_branch_command.rs @@ -88,6 +88,13 @@ fn test_branch_empty_name() { For more information, try '--help'. "###); + + let stderr = test_env.jj_cmd_cli_error(&repo_path, &["branch", "set", ""]); + insta::assert_snapshot!(stderr, @r###" + error: a value is required for '...' but none was supplied + + For more information, try '--help'. + "###); } #[test]