Skip to content

Commit

Permalink
Merge pull request cucumber#391 from cucumber/flag-to-pflag
Browse files Browse the repository at this point in the history
remove renamed imports of pflag.
  • Loading branch information
mattwynne authored Jul 13, 2021
2 parents 9a335ae + cdf3bfc commit 3de6fb0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,12 @@ The following example binds **godog** flags with specified prefix `godog` in ord
package main

import (
"flag" // godog v0.10.0 and earlier
"os"
"testing"

"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag" // godog v0.11.0 (latest)
"github.com/spf13/pflag" // godog v0.11.0 (latest)
)

var opts = godog.Options{
Expand All @@ -361,13 +360,13 @@ var opts = godog.Options{
}

func init() {
godog.BindFlags("godog.", flag.CommandLine, &opts) // godog v0.10.0 and earlier
godog.BindFlags("godog.", pflag.CommandLine, &opts) // godog v0.10.0 and earlier
godog.BindCommandLineFlags("godog.", &opts) // godog v0.11.0 (latest)
}

func TestMain(m *testing.M) {
flag.Parse()
opts.Paths = flag.Args()
pflag.Parse()
opts.Paths = pflag.Args()

status := godog.TestSuite{
Name: "godogs",
Expand Down
6 changes: 3 additions & 3 deletions _examples/assert-godogs/godogs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag"
"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
)

Expand All @@ -18,8 +18,8 @@ func init() {
}

func TestMain(m *testing.M) {
flag.Parse()
opts.Paths = flag.Args()
pflag.Parse()
opts.Paths = pflag.Args()

status := godog.TestSuite{
Name: "godogs",
Expand Down
6 changes: 3 additions & 3 deletions _examples/godogs/godogs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag"
"github.com/spf13/pflag"
)

var opts = godog.Options{Output: colors.Colored(os.Stdout)}
Expand All @@ -17,8 +17,8 @@ func init() {
}

func TestMain(m *testing.M) {
flag.Parse()
opts.Paths = flag.Args()
pflag.Parse()
opts.Paths = pflag.Args()

status := godog.TestSuite{
Name: "godogs",
Expand Down
4 changes: 2 additions & 2 deletions cmd/godog/internal/cmd_root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package internal

import (
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/spf13/pflag"

"github.com/cucumber/godog/internal/flags"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ and contain buildable go source.`,
return rootCmd
}

func bindRootCmdFlags(flagSet *flag.FlagSet) {
func bindRootCmdFlags(flagSet *pflag.FlagSet) {
flagSet.StringVarP(&output, "output", "o", "", "compiles the test runner to the named file")
flagSet.BoolVar(&version, "version", false, "show current version")

Expand Down
8 changes: 4 additions & 4 deletions release-notes/v0.11.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import (

"github.com/cucumber/godog"
"github.com/cucumber/godog/colors"
flag "github.com/spf13/pflag"
"github.com/spf13/pflag"
)

var opts = godog.Options{Output: colors.Colored(os.Stdout)}
Expand All @@ -75,8 +75,8 @@ func init() {
}

func TestMain(m *testing.M) {
flag.Parse()
opts.Paths = flag.Args()
pflag.Parse()
opts.Paths = pflag.Args()

// ...
```
Expand All @@ -91,4 +91,4 @@ To build a test binary, `godog --output g.test [<feature>]`has been replaced wit
Full change log
---------------
See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md#v0110-rc1).
See [CHANGELOG.md](https://github.com/cucumber/godog/blob/master/CHANGELOG.md#v0110-rc1).

0 comments on commit 3de6fb0

Please sign in to comment.