JMS #4: Support for flag handling on command line
This commit is contained in:
parent
ff4e064e21
commit
3b0fc03a67
4
cli.go
4
cli.go
@ -24,7 +24,7 @@ func Run(args []string) {
|
|||||||
set := flagSet(Flags)
|
set := flagSet(Flags)
|
||||||
set.Parse(args[1:])
|
set.Parse(args[1:])
|
||||||
|
|
||||||
context := Context{}
|
context := NewContext(set)
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
name := args[1]
|
name := args[1]
|
||||||
for _, c := range append(Commands, HelpCommand) {
|
for _, c := range append(Commands, HelpCommand) {
|
||||||
@ -48,4 +48,4 @@ type Command struct {
|
|||||||
Flags []Flag
|
Flags []Flag
|
||||||
}
|
}
|
||||||
|
|
||||||
type Handler func(context Context)
|
type Handler func(context *Context)
|
||||||
|
Loading…
Reference in New Issue
Block a user