本文整理汇总了Golang中github.com/algoadv/etcd/Godeps/_workspace/src/github.com/codegangsta/cli.Context.GlobalBool方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.GlobalBool方法的具体用法?Golang Context.GlobalBool怎么用?Golang Context.GlobalBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/algoadv/etcd/Godeps/_workspace/src/github.com/codegangsta/cli.Context
的用法示例。
在下文中一共展示了Context.GlobalBool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: mustNewAuthRoleAPI
func mustNewAuthRoleAPI(c *cli.Context) client.AuthRoleAPI {
hc := mustNewClient(c)
if c.GlobalBool("debug") {
fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", "))
}
return client.NewAuthRoleAPI(hc)
}
示例2: mustNewClientNoSync
func mustNewClientNoSync(c *cli.Context) client.Client {
hc, err := newClient(c)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
if c.GlobalBool("debug") {
fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", "))
client.EnablecURLDebug()
}
return hc
}
示例3: mustNewClient
func mustNewClient(c *cli.Context) client.Client {
hc, err := newClient(c)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
debug := c.GlobalBool("debug")
if debug {
client.EnablecURLDebug()
}
if !c.GlobalBool("no-sync") {
if debug {
fmt.Fprintf(os.Stderr, "start to sync cluster using endpoints(%s)\n", strings.Join(hc.Endpoints(), ","))
}
ctx, cancel := context.WithTimeout(context.Background(), client.DefaultRequestTimeout)
err := hc.Sync(ctx)
cancel()
if err != nil {
if err == client.ErrNoEndpoints {
fmt.Fprintf(os.Stderr, "etcd cluster has no published client endpoints.\n")
fmt.Fprintf(os.Stderr, "Try '--no-sync' if you want to access non-published client endpoints(%s).\n", strings.Join(hc.Endpoints(), ","))
}
handleError(ExitServerError, err)
os.Exit(1)
}
if debug {
fmt.Fprintf(os.Stderr, "got endpoints(%s) after sync\n", strings.Join(hc.Endpoints(), ","))
}
}
if debug {
fmt.Fprintf(os.Stderr, "Cluster-Endpoints: %s\n", strings.Join(hc.Endpoints(), ", "))
}
return hc
}