diff --git a/cmd/bd/ready.go b/cmd/bd/ready.go index b529d3f20..8cf480a82 100644 --- a/cmd/bd/ready.go +++ b/cmd/bd/ready.go @@ -732,6 +732,7 @@ func init() { readyCmd.Flags().String("mol-type", "", "Filter by molecule type: swarm, patrol, or work") readyCmd.Flags().Bool("pretty", true, "Display issues in a tree format with status/priority symbols") readyCmd.Flags().Bool("plain", false, "Display issues as a plain numbered list") + readyCmd.Flags().Bool("flat", false, "Alias for --plain, spelled the way bd list spells it") readyCmd.Flags().Bool("include-deferred", false, "Include issues with future defer_until timestamps") readyCmd.Flags().Bool("include-ephemeral", false, "Include ephemeral issues (wisps) in results") readyCmd.Flags().Bool("gated", false, "Find molecules ready for gate-resume dispatch") diff --git a/cmd/bd/ready_input.go b/cmd/bd/ready_input.go index 04baf9fe1..0643ae3bd 100644 --- a/cmd/bd/ready_input.go +++ b/cmd/bd/ready_input.go @@ -63,6 +63,9 @@ func gatherReadyInput(cmd *cobra.Command, resolveCap func(*cobra.Command) (int, in.Brief, _ = cmd.Flags().GetBool("brief") in.prettyFormat, _ = cmd.Flags().GetBool("pretty") in.plainFormat, _ = cmd.Flags().GetBool("plain") + if flat, _ := cmd.Flags().GetBool("flat"); flat { + in.plainFormat = true + } in.jsonOut = jsonOutput limit, _ := cmd.Flags().GetInt("limit") diff --git a/cmd/bd/ready_input_test.go b/cmd/bd/ready_input_test.go index d189b53e8..1345161ae 100644 --- a/cmd/bd/ready_input_test.go +++ b/cmd/bd/ready_input_test.go @@ -469,6 +469,33 @@ func TestGatherReadyInputIgnoresNegativeOffset(t *testing.T) { } } +// TestGatherReadyInputFlatAliasesPlain pins the flag-name parity with +// `bd list --flat`. Both spellings have to land on plainFormat, because that +// one field is where the direct route and the proxied route each build their +// usePlain choice. +func TestGatherReadyInputFlatAliasesPlain(t *testing.T) { + for _, tc := range []struct { + name string + args []string + want bool + }{ + {name: "neither", args: nil, want: false}, + {name: "plain", args: []string{"--plain"}, want: true}, + {name: "flat", args: []string{"--flat"}, want: true}, + {name: "both", args: []string{"--plain", "--flat"}, want: true}, + } { + t.Run(tc.name, func(t *testing.T) { + got := runGatherReadyInput(t, newReadyFlagsCommand(t, tc.args...), nil) + if got.err != nil { + t.Fatalf("gatherReadyInput(%v) = %v, want no error", tc.args, got.err) + } + if got.in.plainFormat != tc.want { + t.Errorf("plainFormat = %v, want %v", got.in.plainFormat, tc.want) + } + }) + } +} + // TestGatherReadyInputKeepsDirectoryLabelVerbatim pins GH#541's label against // the collapse into workapi. The configured label is not user input: `bd ready` // has always put it on the filter exactly as configured, so it must not be