Skip to content

Instantly share code, notes, and snippets.

@lessless
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lessless/9995138 to your computer and use it in GitHub Desktop.
Save lessless/9995138 to your computer and use it in GitHub Desktop.
package main
import (
"github.com/codegangsta/cli"
"log"
)
func LoginCommand(c *cli.Context) {
//it must be available here
println(debugFlag)
}
package main
import (
"github.com/codegangsta/cli"
"os"
)
const (
APIHOST = "xxx"
)
var debugFlag bool
func main() {
app := cli.NewApp()
app.Name = "test stuff"
app.Usage = "xxxx"
app.Commands = setCommands()
app.Flags = []cli.Flag{cli.BoolFlag{"debug", "enable debugging"}}
app.Action = func(c *cli.Context) {
if c.String("debug") == "true" {
debugFlag = true
}
}
debugFlag = true
app.Run(os.Args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment