本文整理汇总了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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])
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
}
示例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{