Cleaning up the recently-introduced deprecations

to ensure the intent, responsibility, and migration path are all more clear.
main
Dan Buch 9 years ago
parent 879acab1d0
commit 007295e509
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

@ -12,7 +12,9 @@ import (
) )
var ( var (
appActionDeprecationURL = "https://github.com/codegangsta/cli/blob/master/CHANGELOG.md#deprecated-cli-app-action-signature" changeLogURL = "https://github.com/codegangsta/cli/blob/master/CHANGELOG.md"
appActionDeprecationURL = fmt.Sprintf("%s#deprecated-cli-app-action-signature", changeLogURL)
runAndExitOnErrorDeprecationURL = fmt.Sprintf("%s#deprecated-cli-app-runandexitonerror", changeLogURL)
contactSysadmin = "This is an error in the application. Please contact the distributor of this application if this is not you." contactSysadmin = "This is an error in the application. Please contact the distributor of this application if this is not you."
@ -230,9 +232,9 @@ func (a *App) Run(arguments []string) (err error) {
// DEPRECATED: Another entry point to the cli app, takes care of passing arguments and error handling // DEPRECATED: Another entry point to the cli app, takes care of passing arguments and error handling
func (a *App) RunAndExitOnError() { func (a *App) RunAndExitOnError() {
fmt.Fprintln(os.Stderr, fmt.Fprintf(os.Stderr,
"DEPRECATED cli.App.RunAndExitOnError. "+ "DEPRECATED cli.App.RunAndExitOnError. %s See %s\n",
"See https://github.com/codegangsta/cli/blob/master/CHANGELOG.md#deprecated-cli-app-runandexitonerror") contactSysadmin, runAndExitOnErrorDeprecationURL)
if err := a.Run(os.Args); err != nil { if err := a.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
os.Exit(1) os.Exit(1)
@ -421,8 +423,9 @@ func HandleAction(action interface{}, context *Context) (err error) {
vals := reflect.ValueOf(action).Call([]reflect.Value{reflect.ValueOf(context)}) vals := reflect.ValueOf(action).Call([]reflect.Value{reflect.ValueOf(context)})
if len(vals) == 0 { if len(vals) == 0 {
fmt.Fprintln(os.Stderr, fmt.Fprintf(os.Stderr,
"DEPRECATED Action signature. Must be `cli.ActionFunc`") "DEPRECATED Action signature. Must be `cli.ActionFunc`. %s See %s\n",
contactSysadmin, appActionDeprecationURL)
return nil return nil
} }

Loading…
Cancel
Save