From 3b0fc03a6721fa4daffb6deda9723280e857201f Mon Sep 17 00:00:00 2001 From: Jeremy Saenz Date: Wed, 17 Jul 2013 17:14:25 -0700 Subject: [PATCH] JMS #4: Support for flag handling on command line --- cli.go | 4 ++-- help.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli.go b/cli.go index ff06d75..a5ae417 100644 --- a/cli.go +++ b/cli.go @@ -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) diff --git a/help.go b/help.go index 72a4303..b5cb95e 100644 --- a/help.go +++ b/help.go @@ -22,7 +22,7 @@ func init() { HelpCommand.Action = ShowHelp } -func ShowHelp(c Context) { +func ShowHelp(c *Context) { helpTemplate := `NAME: {{.Name}} - {{.Usage}}