當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Command.Flags方法代碼示例

本文整理匯總了Golang中github.com/keybase/cli.Command.Flags方法的典型用法代碼示例。如果您正苦於以下問題:Golang Command.Flags方法的具體用法?Golang Command.Flags怎麽用?Golang Command.Flags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/keybase/cli.Command的用法示例。


在下文中一共展示了Command.Flags方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewCmdSignup

func NewCmdSignup(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	cmd := cli.Command{
		Name:  "signup",
		Usage: "Signup for a new account",
		Action: func(c *cli.Context) {
			cl.ChooseCommand(NewCmdSignupRunner(g), "signup", c)
		},
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "c, invite-code",
				Usage: "Specify an invite code.",
			},
			cli.StringFlag{
				Name:  "email",
				Usage: "Specify an account email.",
			},
			cli.StringFlag{
				Name:  "username",
				Usage: "Specify a username.",
			},
		},
	}
	cmd.Flags = append(cmd.Flags, extraSignupFlags...)
	return cmd
}
開發者ID:moul,項目名稱:client,代碼行數:25,代碼來源:cmd_signup.go

示例2: NewCmdLogin

func NewCmdLogin(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	cmd := cli.Command{
		Name:         "login",
		ArgumentHelp: "[username]",
		Usage:        "Establish a session with the keybase server",
		Action: func(c *cli.Context) {
			cl.ChooseCommand(NewCmdLoginRunner(g), "login", c)
		},
		Flags: []cli.Flag{
			cli.BoolFlag{
				Name:  "provision-by-email",
				Usage: "Use an email address associated with a keybase account to provision a device",
			},
		},
	}
	// Note we'll only be able to set this via mode via Environment variable
	// since it's too early to check command-line setting of it.
	if g.Env.GetRunMode() == libkb.DevelRunMode {
		cmd.Flags = append(cmd.Flags, cli.BoolFlag{
			Name:  "emulate-gui",
			Usage: "emulate GUI signing and fork GPG from the service",
		})
	}
	return cmd
}
開發者ID:qbit,項目名稱:client,代碼行數:25,代碼來源:cmd_login.go

示例3: NewCmdProve

// NewCmdProve makes a new prove command from the given CLI parameters.
func NewCmdProve(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	serviceList := strings.Join(libkb.ListProofCheckers(), ", ")
	description := fmt.Sprintf("Supported services are: %s.", serviceList)
	cmd := cli.Command{
		Name:         "prove",
		ArgumentHelp: "<service> [service username]",
		Usage:        "Generate a new proof",
		Description:  description,
		Flags: []cli.Flag{
			cli.StringFlag{
				Name:  "output, o",
				Usage: "Output proof text to a file (rather than standard out).",
			},
			cli.BoolFlag{
				Name:  "force, f",
				Usage: "Don't prompt.",
			},
		},
		Action: func(c *cli.Context) {
			cl.ChooseCommand(&CmdProve{Contextified: libkb.NewContextified(g)}, "prove", c)
		},
	}
	cmd.Flags = append(cmd.Flags, restrictedProveFlags...)
	return cmd
}
開發者ID:qbit,項目名稱:client,代碼行數:26,代碼來源:cmd_prove.go

示例4: cmdIDAddFlags

func cmdIDAddFlags(cmd *cli.Command) {
	cmd.Flags = append(cmd.Flags, cli.BoolFlag{
		Name:  "delegate-identify-ui",
		Usage: "Delegate our identify UI to another process",
	})
}
開發者ID:mark-adams,項目名稱:client,代碼行數:6,代碼來源:cmd_id_devel.go


注:本文中的github.com/keybase/cli.Command.Flags方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。