Merge pull request #391 from cucumber/flag-to-pflag
remove renamed imports of pflag.
Этот коммит содержится в:
коммит
3de6fb09f3
5 изменённых файлов: 16 добавлений и 17 удалений
|
@ -346,13 +346,12 @@ The following example binds **godog** flags with specified prefix `godog` in ord
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag" // godog v0.10.0 and earlier
|
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/cucumber/godog/colors"
|
"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{
|
var opts = godog.Options{
|
||||||
|
@ -361,13 +360,13 @@ var opts = godog.Options{
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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)
|
godog.BindCommandLineFlags("godog.", &opts) // godog v0.11.0 (latest)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
flag.Parse()
|
pflag.Parse()
|
||||||
opts.Paths = flag.Args()
|
opts.Paths = pflag.Args()
|
||||||
|
|
||||||
status := godog.TestSuite{
|
status := godog.TestSuite{
|
||||||
Name: "godogs",
|
Name: "godogs",
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/cucumber/godog/colors"
|
"github.com/cucumber/godog/colors"
|
||||||
flag "github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
flag.Parse()
|
pflag.Parse()
|
||||||
opts.Paths = flag.Args()
|
opts.Paths = pflag.Args()
|
||||||
|
|
||||||
status := godog.TestSuite{
|
status := godog.TestSuite{
|
||||||
Name: "godogs",
|
Name: "godogs",
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/cucumber/godog/colors"
|
"github.com/cucumber/godog/colors"
|
||||||
flag "github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
||||||
|
@ -17,8 +17,8 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
flag.Parse()
|
pflag.Parse()
|
||||||
opts.Paths = flag.Args()
|
opts.Paths = pflag.Args()
|
||||||
|
|
||||||
status := godog.TestSuite{
|
status := godog.TestSuite{
|
||||||
Name: "godogs",
|
Name: "godogs",
|
||||||
|
|
|
@ -2,7 +2,7 @@ package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
flag "github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
"github.com/cucumber/godog/internal/flags"
|
"github.com/cucumber/godog/internal/flags"
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,7 @@ and contain buildable go source.`,
|
||||||
return rootCmd
|
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.StringVarP(&output, "output", "o", "", "compiles the test runner to the named file")
|
||||||
flagSet.BoolVar(&version, "version", false, "show current version")
|
flagSet.BoolVar(&version, "version", false, "show current version")
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ import (
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
"github.com/cucumber/godog/colors"
|
"github.com/cucumber/godog/colors"
|
||||||
flag "github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
var opts = godog.Options{Output: colors.Colored(os.Stdout)}
|
||||||
|
@ -75,8 +75,8 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
flag.Parse()
|
pflag.Parse()
|
||||||
opts.Paths = flag.Args()
|
opts.Paths = pflag.Args()
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
```
|
```
|
||||||
|
@ -91,4 +91,4 @@ To build a test binary, `godog --output g.test [<feature>]`has been replaced wit
|
||||||
Full change log
|
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).
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче