fix(cli): register --gated flag on bd mol ready subcommand (#3744)
Why: the help text advertised --gated on bd mol ready but Cobra flags do not propagate between sibling commands, so the advertised flag was a hard error; this registers it on molReadyGatedCmd directly. Landed manually (auto-merge disabled) after the branch was updated past the #4623 main-CI fixes and the full check suite ran green. Co-Authored-By: Scott Hamilton <scotthamilton77@gmail.com> Co-Authored-By: matt wilkie <maphew@gmail.com>
This commit is contained in:
parent
b619e2e364
commit
b7d483f963
4 changed files with 49 additions and 3 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
31
cmd/bd/mol_ready_gated_flag_test.go
Normal file
31
cmd/bd/mol_ready_gated_flag_test.go
Normal file
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue