Add deprecation notice to godog CLI (#489)

* Add deprecation notice to godog CLI

* Update CHANGELOG
Этот коммит содержится в:
Viacheslav Poturaev 2022-07-31 15:38:05 +02:00 коммит произвёл GitHub
родитель d45a9aaaa3
коммит 6f3e792c52
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -9,12 +9,15 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
## Unreleased
### Changed
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))
- README example is updated with `context.Context` and `go test` usage. ([477](https://github.com/cucumber/godog/pull/477) - [vearutop](https://github.com/vearutop))
### Fixed
- Fixed a bug which would ignore the context returned from a substep.([488](https://github.com/cucumber/godog/pull/488) - [wichert](https://github.com/wichert))
- Fixed a bug which would cause a panic when using the pretty formatter with a feature that contained a rule. ([480](https://github.com/cucumber/godog/pull/480) - [dumpsterfireproject](https://github.com/dumpsterfireproject))
### Deprecated
- `godog` CLI tool prints deprecation warning. ([489](https://github.com/cucumber/godog/pull/489) - [vearutop](https://github.com/vearutop))
## [v0.12.5]
### Changed
- Changed underlying cobra command setup to return errors instead of calling `os.Exit` directly to enable simpler testing. ([454](https://github.com/cucumber/godog/pull/454) - [mxygem](https://github.com/mxygem))

Просмотреть файл

@ -5,7 +5,9 @@ import (
"go/build"
"path/filepath"
"github.com/cucumber/godog/colors"
"github.com/cucumber/godog/internal/builder"
"github.com/spf13/cobra"
)
@ -37,6 +39,9 @@ The test runner can be executed with the same flags as when using godog run.`,
}
func buildCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
bin, err := filepath.Abs(buildOutput)
if err != nil {
return fmt.Errorf("could not locate absolute path for: %q. reason: %v", buildOutput, err)

Просмотреть файл

@ -44,7 +44,8 @@ func runRootCmd(cmd *cobra.Command, args []string) error {
}
}
fmt.Println(colors.Yellow("Use of godog without a sub-command is deprecated. Please use godog build, godog run or godog version."))
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
return runCmdRunFunc(cmd, args)
}

Просмотреть файл

@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
"github.com/cucumber/godog/colors"
"github.com/cucumber/godog/internal/builder"
"github.com/cucumber/godog/internal/flags"
)
@ -42,6 +43,9 @@ buildable go source.`,
}
func runCmdRunFunc(cmd *cobra.Command, args []string) error {
fmt.Println(colors.Yellow("Use of godog CLI is deprecated, please use *testing.T instead."))
fmt.Println(colors.Yellow("See https://github.com/cucumber/godog/discussions/478 for details."))
osArgs := os.Args[1:]
if len(osArgs) > 0 && osArgs[0] == "run" {