本文整理汇总了Golang中github.com/cloud66/cli.Context.GlobalBool方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.GlobalBool方法的具体用法?Golang Context.GlobalBool怎么用?Golang Context.GlobalBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloud66/cli.Context
的用法示例。
在下文中一共展示了Context.GlobalBool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: beforeCommand
func beforeCommand(c *cli.Context) error {
// set the env vars from global options
if c.GlobalString("runenv") != "production" {
tokenFile = "cx_" + c.GlobalString("runenv") + ".json"
fmt.Printf(ansi.Color(fmt.Sprintf("Running against %s environment\n", c.GlobalString("runenv")), "grey"))
honeybadger.Environment = c.GlobalString("runenv")
} else {
honeybadger.Environment = "production"
}
if c.GlobalString("fayeEndpoint") != "" {
fayeEndpoint = c.GlobalString("fayeEndpoint")
}
debugMode = c.GlobalBool("debug")
var command string
if len(c.Args()) >= 1 {
command = c.Args().First()
}
if (command != "version") && (command != "help") && (command != "update") {
initClients(c)
}
if (command != "update") && (VERSION != "dev") {
defer backgroundRun()
}
return nil
}
示例2: initClients
func initClients(c *cli.Context) {
// is there a token file?
_, err := os.Stat(filepath.Join(cxHome(), tokenFile))
if err != nil {
fmt.Println("No previous authentication found.")
cloud66.Authorize(cxHome(), tokenFile)
os.Exit(1)
} else {
client = cloud66.GetClient(cxHome(), tokenFile, VERSION)
debugMode = c.GlobalBool("debug")
client.Debug = debugMode
}
}
示例3: runUpdate
func runUpdate(c *cli.Context) {
debugMode = c.GlobalBool("debug")
flagForcedVersion = c.String("force")
if debugMode {
fmt.Printf("Current version is %s\n", VERSION)
if flagForcedVersion == "" {
fmt.Println("No forced version")
} else {
fmt.Printf("Forced version is %s\n", flagForcedVersion)
}
}
updateIt, err := needUpdate()
if err != nil {
if debugMode {
fmt.Printf("Cannot verify need for update %v\n", err)
}
return
}
if !updateIt {
if debugMode {
fmt.Println("No need for update")
}
return
}
// houston we have an update. which one do we need?
download, err := getVersionManifest(flagForcedVersion)
if err != nil {
if debugMode {
fmt.Printf("Error fetching manifest %v\n", err)
}
}
if download == nil {
if debugMode {
fmt.Println("Found no matching download for the current OS and ARCH")
}
return
}
err = download.update()
if err != nil {
if debugMode {
fmt.Printf("Failed to update: %v\n", err)
}
return
}
}