Skip to content

Commit

Permalink
Exposed the value accessor in Context
Browse files Browse the repository at this point in the history
  • Loading branch information
corruptmemory committed May 2, 2018
1 parent 8e01ec4 commit b07c0fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion context.go
Expand Up @@ -166,7 +166,7 @@ func (c *Context) Parent() *Context {
}

// value returns the value of the flag coressponding to `name`
func (c *Context) value(name string) interface{} {
func (c *Context) Value(name string) interface{} {
return c.flagSet.Lookup(name).Value.(flag.Getter).Get()
}

Expand Down
4 changes: 2 additions & 2 deletions flag_test.go
Expand Up @@ -93,8 +93,8 @@ func TestFlagsFromEnv(t *testing.T) {
a := App{
Flags: []Flag{test.flag},
Action: func(ctx *Context) error {
if !reflect.DeepEqual(ctx.value(test.flag.GetName()), test.output) {
t.Errorf("expected %+v to be parsed as %+v, instead was %+v", test.input, test.output, ctx.value(test.flag.GetName()))
if !reflect.DeepEqual(ctx.Value(test.flag.GetName()), test.output) {
t.Errorf("expected %+v to be parsed as %+v, instead was %+v", test.input, test.output, ctx.Value(test.flag.GetName()))
}
return nil
},
Expand Down

0 comments on commit b07c0fe

Please sign in to comment.