JMS #4: More WIP
This commit is contained in:
parent
3b0fc03a67
commit
04496e4364
6
cli.go
6
cli.go
@ -22,7 +22,11 @@ var Action = ShowHelp
|
|||||||
func Run(args []string) {
|
func Run(args []string) {
|
||||||
|
|
||||||
set := flagSet(Flags)
|
set := flagSet(Flags)
|
||||||
set.Parse(args[1:])
|
err := set.Parse(args[1:])
|
||||||
|
if err != nil {
|
||||||
|
println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
context := NewContext(set)
|
context := NewContext(set)
|
||||||
if len(args) > 1 {
|
if len(args) > 1 {
|
||||||
|
2
flag.go
2
flag.go
@ -36,7 +36,7 @@ func (f BoolFlag) Apply(set *flag.FlagSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func flagSet(flags []Flag) *flag.FlagSet {
|
func flagSet(flags []Flag) *flag.FlagSet {
|
||||||
set := flag.NewFlagSet("set", flag.PanicOnError)
|
set := flag.NewFlagSet(Name, 0)
|
||||||
for _, f := range flags {
|
for _, f := range flags {
|
||||||
f.Apply(set)
|
f.Apply(set)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user