Skip to content

Commit

Permalink
Merge branch 'master' into author-improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren authored Nov 20, 2019
2 parents e2955ca + 4032749 commit d126101
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Usage documentation exists for each major version. Don't know what version you'r
**Warning**: `v2` is in a beta state.

```
$ go get github.com/urfave/cli.v2
$ go get github.com/urfave/cli/v2
```

```go
Expand Down
1 change: 1 addition & 0 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func GfmrunActionFunc(c *cli.Context) error {
if err != nil {
return err
}
defer file.Close()

var counter int
scanner := bufio.NewScanner(file)
Expand Down
4 changes: 2 additions & 2 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (c *Context) Lineage() []*Context {
return lineage
}

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

Expand Down
4 changes: 2 additions & 2 deletions context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package cli
import (
"context"
"flag"
"sort"
"os"
"sort"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -328,7 +328,7 @@ func TestContextPropagation(t *testing.T) {
parent := NewContext(nil, nil, nil)
parent.Context = context.WithValue(context.Background(), "key", "val")
ctx := NewContext(nil, nil, parent)
val := ctx.Value("key")
val := ctx.Context.Value("key")
if val == nil {
t.Fatal("expected a parent context to be inherited but got nil")
}
Expand Down
4 changes: 2 additions & 2 deletions flag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit d126101

Please sign in to comment.