feat(cmd): add 'bd children <id>' command (bd-scbxh)
Convenience alias for 'bd list --parent <id>'. Lists all child beads of a specified parent, supporting all standard list flags (--json, --pretty, etc.). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
d72f37551b
commit
a3ef7722f9
34
cmd/bd/children.go
Normal file
34
cmd/bd/children.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// childrenCmd lists child beads of a parent.
|
||||
// This is a convenience alias for 'bd list --parent <id>'.
|
||||
var childrenCmd = &cobra.Command{
|
||||
Use: "children <parent-id>",
|
||||
GroupID: "issues",
|
||||
Short: "List child beads of a parent",
|
||||
Long: `List all beads that are children of the specified parent bead.
|
||||
|
||||
This is a convenience alias for 'bd list --parent <id>'.
|
||||
|
||||
Examples:
|
||||
bd children hq-abc123 # List children of hq-abc123
|
||||
bd children hq-abc123 --json # List children in JSON format
|
||||
bd children hq-abc123 --pretty # Show children in tree format`,
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
parentID := args[0]
|
||||
|
||||
// Set the parent flag on listCmd, run it, then reset
|
||||
listCmd.Flags().Set("parent", parentID)
|
||||
defer listCmd.Flags().Set("parent", "")
|
||||
listCmd.Run(listCmd, []string{})
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(childrenCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user