Files
kong/model.go
T
Alec Thomas 1d00dfef7b Implemented most of the base parser.
This includes branching arguments as well as commands, eg.

    app user create <id> <first> <last>
    app user <id> delete
    app user <id> rename <to>

Of note, required/optional flags and positional arguments are not
currently enforced.
2018-05-16 20:33:18 +10:00

45 lines
652 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 {
Name string
Help string
Decoder Decoder
Value reflect.Value
Required bool
}
type Positional = Value
type Argument struct {
Node
Argument *Value
}
type Flag struct {
Value
Placeholder string
Env string
Short rune
Default string
}