From 9a4ce5e13c1d4622ca63c2947d0eaa018ec35715 Mon Sep 17 00:00:00 2001 From: akbash Date: Sat, 1 Aug 2026 23:55:04 +0300 Subject: fix: stop advertising worktree json flag (#2174) refs #2171 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> --- src/cli/spec.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/cli/spec.rs') diff --git a/src/cli/spec.rs b/src/cli/spec.rs index 1f2e85a4..3be83328 100644 --- a/src/cli/spec.rs +++ b/src/cli/spec.rs @@ -229,8 +229,7 @@ fn worktree_command() -> Command { Command::new("list") .about("List worktree workspaces") .arg(option("workspace", "ID")) - .arg(path_option("cwd", "PATH")) - .arg(json_flag()), + .arg(path_option("cwd", "PATH")), ) .subcommand( Command::new("create") @@ -242,8 +241,7 @@ fn worktree_command() -> Command { .arg(path_option("path", "PATH")) .arg(option("label", "TEXT")) .arg(flag("focus")) - .arg(flag("no-focus")) - .arg(json_flag()), + .arg(flag("no-focus")), ) .subcommand( Command::new("open") @@ -254,15 +252,13 @@ fn worktree_command() -> Command { .arg(option("branch", "NAME")) .arg(option("label", "TEXT")) .arg(flag("focus")) - .arg(flag("no-focus")) - .arg(json_flag()), + .arg(flag("no-focus")), ) .subcommand( Command::new("remove") .about("Remove a worktree checkout") .arg(option("workspace", "ID")) - .arg(flag("force")) - .arg(json_flag()), + .arg(flag("force")), ) } @@ -1191,6 +1187,18 @@ mod tests { .contains("Usage: herdr agent rename |--clear")); } + #[test] + fn worktree_json_compatibility_flag_stays_out_of_public_spec() { + let cmd = super::command(); + for subcommand in ["list", "create", "open", "remove"] { + let worktree_command = command_path(&cmd, &["worktree", subcommand]); + assert!( + !has_option(worktree_command, "json"), + "herdr worktree {subcommand} should not advertise --json" + ); + } + } + #[test] fn spec_includes_nested_plugin_pane_open_options() { let cmd = super::command(); -- cgit v1.2.3