Skip to content

Commit 9debe7e

Browse files
committed
Backport removal of deprecation warnings
#508
1 parent d69b440 commit 9debe7e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## [Unreleased]
66

7+
## [1.16.1] - 2016-08-28
8+
### Fixed
9+
- Removed deprecation warnings to STDERR to avoid them leaking to the end-user
10+
711
## [1.16.0] - 2016-05-02
812
### Added
913
- `Hidden` field on all flag struct types to omit from generated help text

app.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ type App struct {
6262
// It is run even if Action() panics
6363
After AfterFunc
6464
// The action to execute when no subcommands are specified
65+
// Expects a `cli.ActionFunc` but will accept the *deprecated* signature of `func(*cli.Context) {}`
66+
// *Note*: support for the deprecated `Action` signature will be removed in a future version
6567
Action interface{}
66-
// TODO: replace `Action: interface{}` with `Action: ActionFunc` once some kind
67-
// of deprecation period has passed, maybe?
6868

6969
// Execute this function if the proper command cannot be found
7070
CommandNotFound CommandNotFoundFunc
@@ -226,11 +226,12 @@ func (a *App) Run(arguments []string) (err error) {
226226
return err
227227
}
228228

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

424425
if len(vals) == 0 {
425-
fmt.Fprintf(os.Stderr,
426-
"DEPRECATED Action signature. Must be `cli.ActionFunc`. %s See %s\n",
427-
contactSysadmin, appActionDeprecationURL)
428426
return nil
429427
}
430428

0 commit comments

Comments
 (0)