JMS #4: Support for flag handling on command line

main
Jeremy Saenz 11 years ago
parent ff4e064e21
commit 3b0fc03a67

@ -24,7 +24,7 @@ func Run(args []string) {
set := flagSet(Flags)
set.Parse(args[1:])
context := Context{}
context := NewContext(set)
if len(args) > 1 {
name := args[1]
for _, c := range append(Commands, HelpCommand) {
@ -48,4 +48,4 @@ type Command struct {
Flags []Flag
}
type Handler func(context Context)
type Handler func(context *Context)

@ -22,7 +22,7 @@ func init() {
HelpCommand.Action = ShowHelp
}
func ShowHelp(c Context) {
func ShowHelp(c *Context) {
helpTemplate := `NAME:
{{.Name}} - {{.Usage}}

Loading…
Cancel
Save