本文整理汇总了Golang中github.com/keybase/client/go/libkb.GlobalContext.ConfigureCommand方法的典型用法代码示例。如果您正苦于以下问题:Golang GlobalContext.ConfigureCommand方法的具体用法?Golang GlobalContext.ConfigureCommand怎么用?Golang GlobalContext.ConfigureCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/keybase/client/go/libkb.GlobalContext
的用法示例。
在下文中一共展示了GlobalContext.ConfigureCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: mainInner
func mainInner(g *libkb.GlobalContext) error {
cl := libcmdline.NewCommandLine(true, client.GetExtraFlags())
cl.AddCommands(client.GetCommands(cl, g))
cl.AddCommands(service.GetCommands(cl, g))
cl.AddHelpTopics(client.GetHelpTopics())
var err error
cmd, err = cl.Parse(os.Args)
if err != nil {
err = fmt.Errorf("Error parsing command line arguments: %s\n", err)
return err
}
if cmd == nil {
return nil
}
if !cl.IsService() {
client.InitUI()
}
if err = g.ConfigureCommand(cl, cmd); err != nil {
return err
}
g.StartupMessage()
warnNonProd(g.Log, g.Env)
if err = configureProcesses(g, cl, &cmd); err != nil {
return err
}
return cmd.Run()
}
示例2: mainInner
func mainInner(g *libkb.GlobalContext) error {
cl := libcmdline.NewCommandLine(true, client.GetExtraFlags())
cl.AddCommands(client.GetCommands(cl, g))
cl.AddCommands(service.GetCommands(cl, g))
cl.AddHelpTopics(client.GetHelpTopics())
var err error
cmd, err = cl.Parse(os.Args)
if err != nil {
err = fmt.Errorf("Error parsing command line arguments: %s\n", err)
return err
}
if cmd == nil {
return nil
}
checkSystemUser(g.Log)
if !cl.IsService() {
client.InitUI()
}
if err = g.ConfigureCommand(cl, cmd); err != nil {
return err
}
g.StartupMessage()
warnNonProd(g.Log, g.Env)
if err = configureProcesses(g, cl, &cmd); err != nil {
return err
}
// Install hook for after startup
install.RunAfterStartup(g, cl.IsService(), g.Log)
err = cmd.Run()
if !cl.IsService() {
// Errors that come up in printing this warning are logged but ignored.
client.PrintOutOfDateWarnings(g)
}
return err
}
示例3: mainInner
func mainInner(g *libkb.GlobalContext) error {
cl := libcmdline.NewCommandLine(true, client.GetExtraFlags())
cl.AddCommands(client.GetCommands(cl, g))
cl.AddCommands(service.GetCommands(cl, g))
cl.AddHelpTopics(client.GetHelpTopics())
var err error
cmd, err = cl.Parse(os.Args)
if err != nil {
err = fmt.Errorf("Error parsing command line arguments: %s\n", err)
return err
}
if cmd == nil {
return nil
}
if !cl.IsService() {
client.InitUI()
}
if err = g.ConfigureCommand(cl, cmd); err != nil {
return err
}
g.StartupMessage()
warnNonProd(g.Log, g.Env)
if cl.IsService() {
return cmd.Run()
}
// Start the server on the other end, possibly.
// There are two cases in which we do this: (1) we want
// a local loopback server in standalone mode; (2) we
// need to "autofork" it. Do at most one of these
// operations.
if g.Env.GetStandalone() {
if cl.IsNoStandalone() {
return fmt.Errorf("Can't run command in standalone mode")
}
if err := service.NewService(false /* isDaemon */, g).StartLoopbackServer(); err != nil {
if pflerr, ok := err.(libkb.PIDFileLockError); ok {
err = fmt.Errorf("Can't run in standalone mode with a service running (see %q)",
pflerr.Filename)
}
return err
}
} else {
// If this command warrants an autofork, do it now.
if fc := cl.GetForkCmd(); fc == libcmdline.ForceFork || (g.Env.GetAutoFork() && fc != libcmdline.NoFork) {
if err = client.ForkServer(cl, g); err != nil {
return err
}
}
// Whether or not we autoforked, we're now running in client-server
// mode (as opposed to standalone). Register a global LogUI so that
// calls to G.Log() in the daemon can be copied to us. This is
// something of a hack on the daemon side.
if !g.Env.GetDoLogForward() {
g.Log.Debug("Disabling log forwarding")
} else {
// TODO This triggers a connection to the RPC server before cmd.Run() is
// called, so the command has no way to deal with errors on its own.
// This should probably be moved into RegisterProtocols?
// Also rpc.RegisterProtocolsWithContext seems to automatically add the
// LogUIProtocol?
err := registerGlobalLogUI(g)
if err != nil {
return err
}
}
}
return cmd.Run()
}