Skip to content

Commit

Permalink
Backport removal of deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jszwedko committed Aug 29, 2016
1 parent 01857ac commit 599ee69
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@

## [Unreleased]

## [1.17.1] - 2016-08-28
### Fixed
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user

## [1.17.0] - 2016-05-09
### Added
- Pluggable flag-level help text rendering via `cli.DefaultFlagStringFunc`
Expand All @@ -25,6 +29,10 @@
- cleanups based on [Go Report Card
feedback](https://goreportcard.com/report/github.com/codegangsta/cli)

## [1.16.1] - 2016-08-28
### Fixed
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user

## [1.16.0] - 2016-05-02
### Added
- `Hidden` field on all flag struct types to omit from generated help text
Expand Down
16 changes: 7 additions & 9 deletions app.go
Expand Up @@ -62,9 +62,9 @@ type App struct {
// It is run even if Action() panics
After AfterFunc
// The action to execute when no subcommands are specified
// Expects a `cli.ActionFunc` but will accept the *deprecated* signature of `func(*cli.Context) {}`
// *Note*: support for the deprecated `Action` signature will be removed in a future version
Action interface{}
// TODO: replace `Action: interface{}` with `Action: ActionFunc` once some kind
// of deprecation period has passed, maybe?

// Execute this function if the proper command cannot be found
CommandNotFound CommandNotFoundFunc
Expand Down Expand Up @@ -244,11 +244,12 @@ func (a *App) Run(arguments []string) (err error) {
return err
}

// DEPRECATED: Another entry point to the cli app, takes care of passing arguments and error handling
// RunAndExitOnError calls .Run() and exits non-zero if an error was returned
//
// Deprecated: instead you should return an error that fulfills cli.ExitCoder
// to cli.App.Run. This will cause the application to exit with the given eror
// code in the cli.ExitCoder
func (a *App) RunAndExitOnError() {
fmt.Fprintf(a.errWriter(),
"DEPRECATED cli.App.RunAndExitOnError. %s See %s\n",
contactSysadmin, runAndExitOnErrorDeprecationURL)
if err := a.Run(os.Args); err != nil {
fmt.Fprintln(a.errWriter(), err)
OsExiter(1)
Expand Down Expand Up @@ -480,9 +481,6 @@ func HandleAction(action interface{}, context *Context) (err error) {
vals := reflect.ValueOf(action).Call([]reflect.Value{reflect.ValueOf(context)})

if len(vals) == 0 {
fmt.Fprintf(ErrWriter,
"DEPRECATED Action signature. Must be `cli.ActionFunc`. %s See %s\n",
contactSysadmin, appActionDeprecationURL)
return nil
}

Expand Down

0 comments on commit 599ee69

Please sign in to comment.