diff --git a/cmd/bd/mol_ready_gated.go b/cmd/bd/mol_ready_gated.go index 190241bb5..a750295f0 100644 --- a/cmd/bd/mol_ready_gated.go +++ b/cmd/bd/mol_ready_gated.go @@ -232,7 +232,10 @@ func findGateReadyMolecules(ctx context.Context, s storage.DoltStorage) ([]*Gate } func init() { - // Note: --gated flag is registered in ready.go - // Also add as a subcommand under mol for discoverability + // `bd ready --gated` registers --gated on readyCmd in ready.go. + // `bd mol ready` is a separate subcommand under molCmd that always runs + // in gated mode, so accept --gated here too: both spellings work and the + // documented `bd mol ready --gated` form actually matches the help text. + molReadyGatedCmd.Flags().Bool("gated", false, "Find molecules ready for gate-resume dispatch (always on for this subcommand)") molCmd.AddCommand(molReadyGatedCmd) } diff --git a/cmd/bd/mol_ready_gated_flag_test.go b/cmd/bd/mol_ready_gated_flag_test.go new file mode 100644 index 000000000..72eb798ee --- /dev/null +++ b/cmd/bd/mol_ready_gated_flag_test.go @@ -0,0 +1,31 @@ +package main + +import "testing" + +// TestMolReadyGatedFlagRegistered guards against the regression where the +// `bd mol ready --gated` help text advertised the flag but no flag was +// registered on the subcommand, so the runtime rejected --gated as unknown. +// +// Both spellings — `bd ready --gated` (registered on readyCmd in ready.go) +// and `bd mol ready --gated` (registered here) — must accept the flag. +func TestMolReadyGatedFlagRegistered(t *testing.T) { + flag := molReadyGatedCmd.Flags().Lookup("gated") + if flag == nil { + t.Fatal("`bd mol ready` is missing the --gated flag; cobra will reject `bd mol ready --gated` with 'unknown flag: --gated'") + } + if flag.Value.Type() != "bool" { + t.Errorf("--gated flag should be bool, got %s", flag.Value.Type()) + } +} + +// TestReadyGatedFlagRegistered guards the sibling spelling `bd ready --gated`, +// which is the path runMolReadyGated is dispatched from in ready.go. +func TestReadyGatedFlagRegistered(t *testing.T) { + flag := readyCmd.Flags().Lookup("gated") + if flag == nil { + t.Fatal("`bd ready` is missing the --gated flag; gate-resume discovery breaks") + } + if flag.Value.Type() != "bool" { + t.Errorf("--gated flag should be bool, got %s", flag.Value.Type()) + } +} diff --git a/docs/CLI_REFERENCE.md b/docs/CLI_REFERENCE.md index 4eb78f6c1..61a10b9ea 100644 --- a/docs/CLI_REFERENCE.md +++ b/docs/CLI_REFERENCE.md @@ -6531,7 +6531,13 @@ Examples: bd mol ready --gated --json # JSON output for automation ``` -bd mol ready --gated +bd mol ready --gated [flags] +``` + +**Flags:** + +``` + --gated Find molecules ready for gate-resume dispatch (always on for this subcommand) ``` #### bd mol seed diff --git a/website/docs/cli-reference/mol.md b/website/docs/cli-reference/mol.md index 6648353f1..fc9709927 100644 --- a/website/docs/cli-reference/mol.md +++ b/website/docs/cli-reference/mol.md @@ -321,6 +321,12 @@ Examples: bd mol ready --gated [flags] ``` +**Flags:** + +``` + --gated Find molecules ready for gate-resume dispatch (always on for this subcommand) +``` + ### bd mol seed Verify that a formula is accessible and can be cooked.