Skip to content
Permalink
Browse files

Exposed the `value` accessor in `Context`

  • Loading branch information
corruptmemory committed May 2, 2018
1 parent 754ed1b commit 5dafdb1de66163e0149529468e66fe127dcd5866
Showing with 3 additions and 3 deletions.
  1. +1 −1 context.go
  2. +2 −2 flag_test.go
@@ -115,7 +115,7 @@ func (c *Context) Lineage() []*Context {
}

// value returns the value of the flag corresponding 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()
}

@@ -121,8 +121,8 @@ func TestFlagsFromEnv(t *testing.T) {
a := App{
Flags: []Flag{test.flag},
Action: func(ctx *Context) error {
if !reflect.DeepEqual(ctx.value(test.flag.Names()[0]), test.output) {
t.Errorf("ex:%01d expected %q to be parsed as %#v, instead was %#v", i, test.input, test.output, ctx.value(test.flag.Names()[0]))
if !reflect.DeepEqual(ctx.Value(test.flag.Names()[0]), test.output) {
t.Errorf("ex:%01d expected %q to be parsed as %#v, instead was %#v", i, test.input, test.output, ctx.Value(test.flag.Names()[0]))
}
return nil
},

0 comments on commit 5dafdb1

Please sign in to comment.
You can’t perform that action at this time.