Last active
August 29, 2015 13:58
-
-
Save lessless/9995138 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/codegangsta/cli" | |
"log" | |
) | |
func LoginCommand(c *cli.Context) { | |
//it must be available here | |
println(debugFlag) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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