I'm trying to get an cli app to error out when certain requirements are not met.
I've been unsuccessful.
I've come to the conclusing the NewExitError is not working at all.
I've compiled the provided Error example from the readme.
package main
import (
"os"
"github.com/codegangsta/cli"
)
func main() {
app := cli.NewApp()
app.Flags = []cli.Flag{
cli.BoolTFlag{
Name: "ginger-crouton",
Usage: "is it in the soup?",
},
}
app.Action = func(ctx *cli.Context) error {
if !ctx.Bool("ginger-crouton") {
return cli.NewExitError("it is not in the soup", 86)
}
return nil
}
app.Run(os.Args)
}
OS: Windows 7 Enterprise
GO: 1.6.2
Expected Terminal Output: "it is not in the soup"
Expected Windows RETVAL (%ERRORLEVEL%): 86
Current output: Nothing
Current Windows RETVAL (%ERRORLEVEL%): 0
I've already checked my Go ENV; Also redownloaded the package.
Can someone please confirm this issue for me by also compiling and running the error example from the README.
I think I found the origin of the problem, will create branch for pull request
You're fix looks more complete :+1:
Most helpful comment
I think I found the origin of the problem, will create branch for pull request