Files
kong/model.go
T
2018-05-17 20:16:12 +10:00

48 lines
801 B
Go

package kong
import "reflect"
type Application = Node
// A Branch is a command or positional argument that results in a branch in the command tree.
type Branch struct {
Command *Command
Argument *Argument
}
type Command = Node
type Node struct {
Name string
Help string
Flags []*Flag
Positional []*Value
Children []*Branch
}
type Value struct {
Flag bool // True if flag, false if positional argument.
Name string
Help string
Decoder Decoder
Field reflect.StructField
Value reflect.Value
Required bool
Format string // Formatting directive, if applicable.
}
type Positional = Value
type Argument struct {
Node
Argument *Value
}
type Flag struct {
Value
Placeholder string
Env string
Short rune
Default string
}