Implement a robust Context.Run().

This helps when composing large applications from separate command
structs.
This commit is contained in:
Alec Thomas
2018-06-21 21:50:30 +10:00
parent e4f37b5d1a
commit a2ec050947
16 changed files with 727 additions and 279 deletions
+5
View File
@@ -43,6 +43,11 @@ type Node struct {
Argument *Value // Populated when Type is ArgumentNode.
}
// Leaf returns true if this Node is a leaf node.
func (n *Node) Leaf() bool {
return len(n.Children) == 0
}
// Find a command/argument/flag by pointer to its field.
//
// Returns nil if not found. Panics if ptr is not a pointer.