fix(cli): accept --flat on bd ready as an alias for --plain (#5724)
`bd list --flat` disables the tree view; `bd ready --plain` does the same thing under a different name. A user who learns the flag from bd list and tries `bd ready --flat` gets "unknown flag: --flat" and exit 1, with nothing in the error pointing at --plain. Register --flat on ready and fold it into the existing plainFormat choice in gatherReadyInput, which is the one place both routes parse the command's flags, so the direct and proxied listings pick it up together. --plain stays the canonical spelling and its behavior is unchanged. Generated CLI docs are not regenerated: docs/cli-docs.pin builds them from tag v1.1.0, not HEAD. ./scripts/check-cli-docs-drift.sh --base main and ./scripts/check-doc-flags.sh both pass. Co-authored-by: postoso <postoso@users.noreply.github.com>
This commit is contained in:
parent
671db6560d
commit
92f9293297
3 changed files with 31 additions and 0 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue