本文整理汇总了Golang中github.com/gondor/depcon/pkg/cli.Output函数的典型用法代码示例。如果您正苦于以下问题:Golang Output函数的具体用法?Golang Output怎么用?Golang Output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Output函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: execActionWithPreHook
func execActionWithPreHook(action ComposeAction, preHook ComposePreHook) func(cmd *cobra.Command, args []string) {
return func(cmd *cobra.Command, args []string) {
composeFile, _ := cmd.Flags().GetString(COMPOSE_FILE_FLAG)
projName, _ := cmd.Flags().GetString(PROJECT_NAME_FLAG)
compose := preHook(composeFile, projName, cmd)
err := action(compose, cmd, args)
if err != nil {
cli.Output(nil, err)
}
}
}
开发者ID:f1yegor,项目名称:depcon,代码行数:13,代码来源:actions.go
示例15: listGroups
func listGroups(cmd *cobra.Command, args []string) {
v, e := client(cmd).ListGroups()
cli.Output(AppGroups{v}, e)
}
开发者ID:shirkevich,项目名称:depcon,代码行数:4,代码来源:group_cmds.go
示例16:
)
var deployCmd = &cobra.Command{
Use: "deploy",
Short: "Marathon deployment management",
Long: `Manage deployments in a marathon cluster (eg. creating, listing, monitoring)
See deploy's subcommands for available choices`,
}
var deployListCmd = &cobra.Command{
Use: "list",
Short: "List all deployments",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).ListDeployments()
cli.Output(&Deployments{Deploys: v}, e)
},
}
var deployDeleteCmd = &cobra.Command{
Use: "delete [deploymentId]",
Short: "Delete a deployment by [deploymentID]",
Run: func(cmd *cobra.Command, args []string) {
if cli.EvalPrintUsage(cmd.Usage, args, 1) {
return
}
v, e := client(cmd).DeleteDeployment(args[0])
cli.Output(&DeploymentId{v}, e)
},
}
开发者ID:f1yegor,项目名称:depcon,代码行数:30,代码来源:deploy_cmds.go
示例17:
Short: "Updates [applicationId] to have [cpu_shares]",
Run: updateAppCPU,
}
var appUpdateMemoryCmd = &cobra.Command{
Use: "mem [applicationId] [amount]",
Short: "Updates [applicationId] to have [amount] of memory in MB",
Run: updateAppMemory,
}
var appListCmd = &cobra.Command{
Use: "list",
Short: "List all applications",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).ListApplications()
cli.Output(Applications{v}, e)
},
}
var appGetCmd = &cobra.Command{
Use: "get [applicationId]",
Short: "Gets an application details by Id",
Long: `Retrieves the specified [appliationId] application`,
Run: func(cmd *cobra.Command, args []string) {
if cli.EvalPrintUsage(cmd.Usage, args, 1) {
return
}
v, e := client(cmd).GetApplication(args[0])
cli.Output(Application{v}, e)
},
}
开发者ID:f1yegor,项目名称:depcon,代码行数:31,代码来源:app_cmds.go
示例18:
)
var taskCmd = &cobra.Command{
Use: "task",
Short: "Marathon task management",
Long: `Manage tasks in a marathon cluster (eg. creating, listing, monitoring, kill)
See tasks's subcommands for available choices`,
}
var taskListCmd = &cobra.Command{
Use: "list",
Short: "List all tasks",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).ListTasks()
cli.Output(&Tasks{Tasks: v}, e)
},
}
var taskQueueCmd = &cobra.Command{
Use: "queue",
Short: "List all queued tasks",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).ListQueue()
cli.Output(&QueuedTasks{v}, e)
},
}
var appTaskGetCmd = &cobra.Command{
Use: "get [applicationId]",
Short: "List tasks for the application [applicationId]",
开发者ID:f1yegor,项目名称:depcon,代码行数:31,代码来源:task_cmds.go
示例19:
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{
Use: "add",
Short: "Adds a new environment",
Run: func(cmd *cobra.Command, args []string) {
configFile.AddEnvironment()
},
开发者ID:f1yegor,项目名称:depcon,代码行数:31,代码来源:config.go
示例20:
)
var serverCmd = &cobra.Command{
Use: "server",
Short: "Marathon server information",
Long: `View Marathon server information and current leader
See server's subcommands for available choices`,
}
var serverInfoCmd = &cobra.Command{
Use: "info",
Short: "Get info about the Marathon Instance",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).GetMarathonInfo()
cli.Output(MarInfo{v}, e)
},
}
var serverLeaderCmd = &cobra.Command{
Use: "leader",
Short: "Marathon leader management",
}
var serverLeaderGetCmd = &cobra.Command{
Use: "get",
Short: "Show the current leader",
Run: func(cmd *cobra.Command, args []string) {
v, e := client(cmd).GetCurrentLeader()
cli.Output(MarLeaderInfo{v}, e)
},
开发者ID:f1yegor,项目名称:depcon,代码行数:31,代码来源:server_cmds.go
注:本文中的github.com/gondor/depcon/pkg/cli.Output函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论