• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang cli.EvalPrintUsage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/gondor/depcon/pkg/cli.EvalPrintUsage函数的典型用法代码示例。如果您正苦于以下问题:Golang EvalPrintUsage函数的具体用法?Golang EvalPrintUsage怎么用?Golang EvalPrintUsage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了EvalPrintUsage函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: createGroup

func createGroup(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	wait, _ := cmd.Flags().GetBool(WAIT_FLAG)
	force, _ := cmd.Flags().GetBool(FORCE_FLAG)
	params, _ := cmd.Flags().GetStringSlice(PARAMS_FLAG)
	ignore, _ := cmd.Flags().GetBool(IGNORE_MISSING)
	options := &marathon.CreateOptions{Wait: wait, Force: force, ErrorOnMissingParams: !ignore}

	if params != nil {
		envmap := make(map[string]string)
		for _, p := range params {
			if strings.Contains(p, "=") {
				v := strings.Split(p, "=")
				envmap[v[0]] = v[1]
			}
		}
		options.EnvParams = envmap
	}

	result, e := client(cmd).CreateGroupFromFile(args[0], options)
	if e != nil && e == marathon.ErrorGroupExists {
		cli.Output(nil, fmt.Errorf("%s, consider using the --force flag to update when group exists", e.Error()))
		return
	}
	cli.Output(AppGroup{result}, e)
}
开发者ID:shirkevich,项目名称:depcon,代码行数:29,代码来源:group_cmds.go


示例2: createApp

func createApp(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	wait, _ := cmd.Flags().GetBool(WAIT_FLAG)
	force, _ := cmd.Flags().GetBool(FORCE_FLAG)
	paramsFile, _ := cmd.Flags().GetString(ENV_FILE_FLAG)
	params, _ := cmd.Flags().GetStringSlice(PARAMS_FLAG)
	ignore, _ := cmd.Flags().GetBool(IGNORE_MISSING)
	options := &marathon.CreateOptions{Wait: wait, Force: force, ErrorOnMissingParams: !ignore}

	if paramsFile != "" {
		envParams, _ := parseParamsFile(paramsFile)
		options.EnvParams = envParams
	} else {
		options.EnvParams = make(map[string]string)
	}

	if params != nil {
		for _, p := range params {
			if strings.Contains(p, "=") {
				v := strings.Split(p, "=")
				options.EnvParams[v[0]] = v[1]
			}
		}
	}

	result, e := client(cmd).CreateApplicationFromFile(args[0], options)
	if e != nil && e == marathon.ErrorAppExists {
		cli.Output(nil, errors.New(fmt.Sprintf("%s, consider using the --force flag to update when an application exists", e.Error())))
		return
	}
	cli.Output(Application{result}, e)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:35,代码来源:app_cmds.go


示例3: destroyGroup

func destroyGroup(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}
	v, e := client(cmd).DestroyGroup(args[0])
	cli.Output(DeploymentId{v}, e)
}
开发者ID:shirkevich,项目名称:depcon,代码行数:7,代码来源:group_cmds.go


示例4: appKillTask

func appKillTask(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}
	scale, _ := cmd.Flags().GetBool(SCALE_FLAG)
	v, e := client(cmd).KillAppTask(args[0], scale)
	cli.Output(Task{v}, e)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:8,代码来源:task_cmds.go


示例5: getGroup

func getGroup(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	v, e := client(cmd).GetGroup(args[0])
	cli.Output(AppGroup{v}, e)
}
开发者ID:shirkevich,项目名称:depcon,代码行数:8,代码来源:group_cmds.go


示例6: destroyApp

func destroyApp(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	v, e := client(cmd).DestroyApplication(args[0])
	cli.Output(DeploymentId{v}, e)
	waitForDeploymentIfFlagged(cmd, v.DeploymentID)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:9,代码来源:app_cmds.go


示例7: convertFile

func convertFile(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 2) {
		return
	}
	if err := encoding.ConvertFile(args[0], args[1], &marathon.Application{}); err != nil {
		cli.Output(nil, err)
		return
	}
	fmt.Printf("Source file %s has been re-written into new format in %s\n\n", args[0], args[1])
}
开发者ID:f1yegor,项目名称:depcon,代码行数:10,代码来源:app_cmds.go


示例8: appKillAllTasks

func appKillAllTasks(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	host, _ := cmd.Flags().GetString(HOST_FLAG)
	scale, _ := cmd.Flags().GetBool(SCALE_FLAG)

	v, e := client(cmd).KillAppTasks(args[0], host, scale)
	cli.Output(&Tasks{Tasks: v}, e)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:11,代码来源:task_cmds.go


示例9: rollbackAppVersion

func rollbackAppVersion(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 2) {
		return
	}

	wait, _ := cmd.Flags().GetBool(WAIT_FLAG)

	update := marathon.NewApplication(args[0]).RollbackVersion(args[1])
	v, e := client(cmd).UpdateApplication(update, wait)
	cli.Output(Application{v}, e)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:11,代码来源:app_cmds.go


示例10: restartApp

func restartApp(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	force, _ := cmd.Flags().GetBool(FORCE_FLAG)

	v, e := client(cmd).RestartApplication(args[0], force)
	cli.Output(DeploymentId{v}, e)
	waitForDeploymentIfFlagged(cmd, v.DeploymentID)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:11,代码来源:app_cmds.go


示例11: scaleApp

func scaleApp(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 2) {
		return
	}

	instances, err := strconv.Atoi(args[1])
	if err != nil {
		cli.Output(nil, err)
		return
	}
	v, e := client(cmd).ScaleApplication(args[0], instances)
	cli.Output(DeploymentId{v}, e)
	waitForDeploymentIfFlagged(cmd, v.DeploymentID)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:14,代码来源:app_cmds.go


示例12: updateAppMemory

func updateAppMemory(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 2) {
		return
	}

	wait, _ := cmd.Flags().GetBool(WAIT_FLAG)
	mem, err := strconv.ParseFloat(args[1], 64)

	if err != nil {
		cli.Output(nil, err)
		return
	}
	update := marathon.NewApplication(args[0]).Memory(mem)
	v, e := client(cmd).UpdateApplication(update, wait)
	cli.Output(Application{v}, e)
}
开发者ID:f1yegor,项目名称:depcon,代码行数:16,代码来源:app_cmds.go


示例13: appTasks

func appTasks(cmd *cobra.Command, args []string) {
	if cli.EvalPrintUsage(cmd.Usage, args, 1) {
		return
	}

	detailed, _ := cmd.Flags().GetBool(DETAIL_FLAG)

	v, e := client(cmd).GetTasks(args[0])

	if detailed && e == nil {
		fmt.Println("")
		for _, t := range v {
			fmt.Printf("::: Task: %s\n\n", t.ID)
			cli.Output(&Task{t}, e)
		}
	} else {
		cli.Output(&Tasks{Tasks: v}, e)
	}

}
开发者ID:f1yegor,项目名称:depcon,代码行数:20,代码来源:task_cmds.go


示例14:

See config's subcommands for available choices`,
}

var configEnvCmd = &cobra.Command{
	Use:   "env",
	Short: "Configuration environments define remote Marathon and other supported services by a name. ",
	Long: `Manage configuration environments (eg. default, list, adding and removing of environments)

See env's subcommands for available choices`,
}

var configRemoveCmd = &cobra.Command{
	Use:   "delete [name]",
	Short: "Remove a defined environment by it's [name]",
	Run: func(cmd *cobra.Command, args []string) {
		if cli.EvalPrintUsage(cmd.Usage, args, 1) {
			return
		}
		_, err := configFile.GetEnvironment(args[0])
		if err != nil {
			cli.Output(nil, err)
		} else {
			err := configFile.RemoveEnvironment(args[0], false)
			if err != nil {
				cli.Output(nil, err)
			}
		}
	},
}

var configAddCmd = &cobra.Command{
开发者ID:f1yegor,项目名称:depcon,代码行数:31,代码来源:config.go



注:本文中的github.com/gondor/depcon/pkg/cli.EvalPrintUsage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang cli.Output函数代码示例发布时间:2022-05-23
下一篇:
Golang compose.Compose类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap