本文整理汇总了Golang中github.com/keybase/cli.Context类的典型用法代码示例。如果您正苦于以下问题:Golang Context类的具体用法?Golang Context怎么用?Golang Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Context类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ParseArgv
func (v *CmdLaunchdStatus) ParseArgv(ctx *cli.Context) error {
args := ctx.Args()
if len(args) < 1 {
return fmt.Errorf("No service name specified.")
}
// Resolve any label "aliases"
labelStr := args[0]
switch labelStr {
case "service":
labelStr = install.DefaultServiceLabel(v.G().Env.GetRunMode())
case "kbfs":
labelStr = install.DefaultKBFSLabel(v.G().Env.GetRunMode())
case "updater":
labelStr = install.DefaultUpdaterLabel(v.G().Env.GetRunMode())
}
label, err := install.NewServiceLabel(labelStr)
if err != nil {
return err
}
v.label = label
v.format = ctx.String("format")
return nil
}
开发者ID:qbit,项目名称:client,代码行数:26,代码来源:cmd_launchd_osx.go
示例2: ParseArgv
// ParseArgv gets the secret phrase from the command args.
func (c *CmdDeviceAdd) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("Device add only takes one argument, the secret phrase.")
}
c.phrase = ctx.Args()[0]
return nil
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:8,代码来源:cmd_device_add.go
示例3: ParseTypes
func (s *CmdSigsList) ParseTypes(ctx *cli.Context) error {
tmp := ctx.String("type")
if len(tmp) == 0 {
return nil
}
types := map[string]bool{
"track": true,
"proof": true,
"cryptocurrency": true,
"self": true,
}
ret := make(map[string]bool)
v := strings.Split(tmp, ",")
for _, i := range v {
ok, found := types[i]
if !ok || !found {
return fmt.Errorf("Unknown signature type: %s", i)
}
ret[i] = true
}
s.types = ret
return nil
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:25,代码来源:cmd_sigs_list.go
示例4: ParseArgv
func (v *CmdUntrack) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("Unfollow only takes one argument, the user to unfollow.")
}
v.user = ctx.Args()[0]
return nil
}
开发者ID:qbit,项目名称:client,代码行数:7,代码来源:cmd_unfollow.go
示例5: ParseArgv
func (c *CmdRevoke) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("Revoke takes exactly one key.")
}
c.id = ctx.Args()[0]
return nil
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:7,代码来源:cmd_revoke.go
示例6: ParseArgv
func (s *CmdPGPList) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) > 0 {
return UnexpectedArgsError("pgp list")
}
return nil
}
开发者ID:qbit,项目名称:client,代码行数:7,代码来源:cmd_pgp_list.go
示例7: ParseArgv
func (c *CmdStatus) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) > 0 {
return UnexpectedArgsError("status")
}
c.json = ctx.Bool("json")
return nil
}
开发者ID:Varjelus,项目名称:keybase-client,代码行数:7,代码来源:cmd_status.go
示例8: ParseArgv
func (v *CmdUpdateRun) ParseArgv(ctx *cli.Context) error {
currentVersion := ctx.String("current-version")
if currentVersion != "" {
v.options.Version = currentVersion
}
destinationPath := ctx.String("destination-path")
if destinationPath != "" {
v.options.DestinationPath = destinationPath
}
source := ctx.String("source")
if source != "" {
v.options.Source = source
}
v.options.URL = ctx.String("url")
v.options.Force = ctx.Bool("force")
if v.options.DestinationPath == "" {
return fmt.Errorf("No default destination path for this environment")
}
return nil
}
开发者ID:Varjelus,项目名称:keybase-client,代码行数:25,代码来源:cmd_update.go
示例9: ParseArgv
func (c *CmdFakeTrackingChanged) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("Must provide exactly one username.")
}
c.arg.Username = ctx.Args()[0]
return nil
}
开发者ID:qbit,项目名称:client,代码行数:7,代码来源:cmd_fake_following_changed.go
示例10: ParseArgv
func (c *CmdPGPDrop) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("drop takes exactly one key")
}
c.id = ctx.Args()[0]
return nil
}
开发者ID:polluks,项目名称:client,代码行数:7,代码来源:cmd_pgp_drop.go
示例11: ParseArgv
func (c *CmdWatchdog) ParseArgv(ctx *cli.Context) error {
c.restarts = ctx.Int("num-restarts")
if c.restarts == 0 {
c.restarts = numRestartsDefault
}
return nil
}
开发者ID:mark-adams,项目名称:client,代码行数:8,代码来源:cmd_ctl_watchdog.go
示例12: ParseArgv
func (v *cmdUpdateNotify) ParseArgv(ctx *cli.Context) error {
v.force = ctx.Bool("force")
v.event = ctx.Args().First()
if v.event == "" {
return fmt.Errorf("No event specified")
}
return nil
}
开发者ID:qbit,项目名称:client,代码行数:8,代码来源:cmd_update.go
示例13: ParseArgv
func (v *CmdLaunchdAction) ParseArgv(ctx *cli.Context) error {
args := ctx.Args()
if len(args) < 1 {
return fmt.Errorf("Need to specify launchd label")
}
v.label = args[0]
return nil
}
开发者ID:mark-adams,项目名称:client,代码行数:8,代码来源:cmd_launchd_osx.go
示例14: ParseArgv
func (c *CmdSearch) ParseArgv(ctx *cli.Context) error {
c.query = strings.Join(ctx.Args(), " ")
if c.query == "" {
return fmt.Errorf("Search query must not be empty.")
}
c.json = ctx.Bool("json")
return nil
}
开发者ID:Varjelus,项目名称:keybase-client,代码行数:8,代码来源:cmd_search.go
示例15: ParseArgv
func (v *CmdLogin) ParseArgv(ctx *cli.Context) (err error) {
nargs := len(ctx.Args())
if nargs > 1 {
err = errors.New("Invalid arguments.")
} else if nargs == 1 {
v.Username = ctx.Args()[0]
}
return err
}
开发者ID:paul-pearce,项目名称:client-beta,代码行数:9,代码来源:cmd_login.go
示例16: ParseArgv
func (v *CmdTrack) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) != 1 {
return fmt.Errorf("Track only takes one argument, the user to follow.")
}
v.user = ctx.Args()[0]
v.options = keybase1.TrackOptions{LocalOnly: ctx.Bool("local"), BypassConfirm: ctx.Bool("y")}
v.skipProofCache = ctx.Bool("skip-proof-cache")
return nil
}
开发者ID:qbit,项目名称:client,代码行数:9,代码来源:cmd_follow.go
示例17: ParseArgv
func (v *CmdConfigGet) ParseArgv(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
return fmt.Errorf("Not enough arguments.")
}
v.key = ctx.Args()[0]
if v.writer == nil {
v.writer = GlobUI.OutputWriter()
}
return nil
}
开发者ID:moul,项目名称:client,代码行数:10,代码来源:cmd_config.go
示例18: ParseArgv
func (v *CmdVersion) ParseArgv(c *cli.Context) error {
switch c.String("format") {
case "s":
v.mode = modeShort
case "v":
v.mode = modeVerbose
}
v.svc = !c.Bool("S")
return nil
}
开发者ID:mark-adams,项目名称:client,代码行数:10,代码来源:cmd_version.go
示例19: ParseArgv
func (c *CmdPGPDrop) ParseArgv(ctx *cli.Context) (err error) {
if len(ctx.Args()) != 1 {
return fmt.Errorf("drop takes exactly one key")
}
c.id, err = keybase1.KIDFromStringChecked(ctx.Args()[0])
if err != nil {
return fmt.Errorf("bad key: %v", err)
}
return nil
}
开发者ID:mark-adams,项目名称:client,代码行数:10,代码来源:cmd_pgp_drop.go
示例20: ParseArgv
func (v *CmdDumpKeyfamily) ParseArgv(ctx *cli.Context) error {
nargs := len(ctx.Args())
if nargs > 1 {
return fmt.Errorf("dump-keyfamily only takes one argument, the user to lookup")
}
if nargs == 1 {
v.user = ctx.Args()[0]
}
return nil
}
开发者ID:qbit,项目名称:client,代码行数:10,代码来源:cmd_dump_keyfamily.go
注:本文中的github.com/keybase/cli.Context类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论