当前位置: 首页>>代码示例>>Golang>>正文


Golang App.Commands方法代码示例

本文整理汇总了Golang中github.com/codegangsta/cli.App.Commands方法的典型用法代码示例。如果您正苦于以下问题:Golang App.Commands方法的具体用法?Golang App.Commands怎么用?Golang App.Commands使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/codegangsta/cli.App的用法示例。


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

示例1: loadCommands

func loadCommands(app *cli.App) {
	app.Action = mainCmd

	app.Flags = []cli.Flag{
		cli.StringFlag{"assigned", "", "display issues assigned to <user>. Use '*' for all assigned, or 'none' for all unassigned."},
		cli.BoolFlag{"no-trunc", "do not truncate the issue name"},
	}

	app.Commands = []cli.Command{
		{
			Name:   "alru",
			Usage:  "Show the Age of the Least Recently Updated issue for this repo. Lower is better.",
			Action: alruCmd,
		},
		{
			Name:   "repo",
			Usage:  "List information about the current repository",
			Action: repositoryInfoCmd,
		},
		{
			Name:   "auth",
			Usage:  "Add a github token for authentication",
			Action: authCmd,
			Flags: []cli.Flag{
				cli.StringFlag{"add", "", "add new token for authentication"},
			},
		},
	}
}
开发者ID:jamtur01,项目名称:pulls,代码行数:29,代码来源:commands.go

示例2: setupPingCommand

func setupPingCommand(app *cli.App) {
	app.Commands = append(app.Commands, cli.Command{
		Name:    "ping",
		Aliases: []string{"p"},
		Usage:   "ping the cluster to see if it's available",
		Action:  ping,
	},
	)
}
开发者ID:rodaine,项目名称:esu,代码行数:9,代码来源:ping.go

示例3: setupGlobalCommands

func setupGlobalCommands(app *cli.App) {
	app.Commands = []cli.Command{
		{
			Name:    "help",
			Aliases: []string{"man"},
			Usage:   "prints this help message",
			Action:  cli.ShowAppHelp,
		},
	}
}
开发者ID:rodaine,项目名称:esu,代码行数:10,代码来源:app.go

示例4: loadCommands

func loadCommands(app *cli.App) {
	app.Action = mainCmd

	app.Flags = []cli.Flag{
		cli.StringFlag{"assigned", "", "display issues assigned to <user>. Use '*' for all assigned, or 'none' for all unassigned."},
		cli.StringFlag{"remote", "origin", "git remote to treat as origin"},
		cli.BoolFlag{"no-trunc", "do not truncate the issue name"},
		cli.IntFlag{"votes", -1, "display the number of votes '+1' filtered by the <number> specified."},
		cli.BoolFlag{"vote", "add '+1' to an specific issue."},
	}

	app.Commands = []cli.Command{
		{
			Name:   "alru",
			Usage:  "Show the Age of the Least Recently Updated issue for this repo. Lower is better.",
			Action: alruCmd,
		},
		{
			Name:   "repo",
			Usage:  "List information about the current repository",
			Action: repositoryInfoCmd,
		},
		{
			Name:   "take",
			Usage:  "Assign an issue to your github account",
			Action: takeCmd,
			Flags: []cli.Flag{
				cli.BoolFlag{"overwrite", "overwrites a taken issue"},
			},
		},
		{
			Name:   "search",
			Usage:  "Find issues by state and keyword.",
			Action: searchCmd,
			Flags: []cli.Flag{
				cli.StringFlag{"author", "", "Finds issues created by a certain user"},
				cli.StringFlag{"assignee", "", "Finds issues that are assigned to a certain user"},
				cli.StringFlag{"mentions", "", "Finds issues that mention a certain user"},
				cli.StringFlag{"commenter", "", "Finds issues that a certain user commented on"},
				cli.StringFlag{"involves", "", "Finds issues that were either created by a certain user, assigned to that user, mention that user, or were commented on by that user"},
				cli.StringFlag{"labels", "", "Filters issues based on their labels"},
				cli.StringFlag{"state", "", "Filter issues based on whether they’re open or closed"},
			},
		},
		{
			Name:   "auth",
			Usage:  "Add a github token for authentication",
			Action: authCmd,
			Flags: []cli.Flag{
				cli.StringFlag{"add", "", "add new token for authentication"},
			},
		},
	}
}
开发者ID:rjnagal,项目名称:gordon,代码行数:54,代码来源:commands.go

示例5: loadCommands

func loadCommands(app *cli.App) {
	// default to listing a service
	app.Action = getAction

	app.Flags = []cli.Flag{
		cli.BoolFlag{"json", "output to json"},
		cli.StringFlag{"host", os.Getenv("SKYDNS"), "url to SkyDNS's HTTP endpoints (defaults to env. var. SKYDNS)"},
		cli.StringFlag{"dns",
			func() string {
				if x := os.Getenv("SKYDNS_DNS"); x != "" {
					if strings.HasPrefix(x, "http") {
						return x
					}
					return "http://" + x // default to http for now
				}
				return "127.0.0.1:53"
			}(), "DNS port of SkyDNS's DNS endpoint (defaults to env. var. SKYDNS_DNS)"},
		cli.StringFlag{"domain",
			func() string {
				if x := os.Getenv("SKYDNS_DOMAIN"); x != "" {
					return x
				}
				return "skydns.local"
			}(), "DNS domain of SkyDNS (defaults to env. var. SKYDNS_DOMAIN))"},
		cli.StringFlag{"secret", "", "secret to authenticate with"},
	}

	app.Commands = []cli.Command{
		{
			Name:   "list",
			Usage:  "list a service from skydns",
			Action: getAction,
			Flags:  []cli.Flag{cli.BoolFlag{"d", "use DNS instead of HTTP"}},
		},
		{
			Name:   "add",
			Usage:  "add a new service to skydns",
			Action: addAction,
		},
		{
			Name:   "delete",
			Usage:  "delete a service from skydns",
			Action: deleteAction,
		},
		{
			Name:   "update",
			Usage:  "update a service's ttl in skydns",
			Action: updateAction,
		},
	}
}
开发者ID:johansenj,项目名称:skydns,代码行数:51,代码来源:main.go

示例6: setCommands

func setCommands(app *cli.App) {
	commands := []cli.Command{}

	// TODO: Automaticaly load the commands based on the cmd directory content.
	commands = append(commands, cmd.Init())
	commands = append(commands, cmd.List())
	commands = append(commands, cmd.On())
	commands = append(commands, cmd.Log())
	commands = append(commands, cmd.Stop())
	commands = append(commands, cmd.Done())
	commands = append(commands, cmd.Status())

	app.Commands = commands
}
开发者ID:TechMantra,项目名称:focus,代码行数:14,代码来源:cli.go

示例7: main

func main() {
	var app *cli.App
	app = cli.NewApp()
	app.Name = APP_NAME
	app.Version = APP_VER
	app.Usage = "email for mail sending, or web or none for run web interface!"
	app.Commands = []cli.Command{
		task.CmdWeb,
		task.CmdEmail,
	}
	app.Flags = append(app.Flags, []cli.Flag{}...)

	app.Run(os.Args)
}
开发者ID:qSlide,项目名称:qslide,代码行数:14,代码来源:qs.go

示例8: loadCommands

func loadCommands(app *cli.App) {
	// default to listing a service
	app.Action = getAction

	app.Flags = []cli.Flag{
		cli.BoolFlag{"json", "output to json"},
		cli.StringFlag{"host", os.Getenv("SKYDNS"), "url to SkyDNS's HTTP endpoints (defaults to env. var. SKYDNS)"},
		cli.StringFlag{"dnsport",
			func() string {
				x := os.Getenv("SKYDNS_DNSPORT")
				if x == "" {
					x = "53"
				}
				return x
			}(), "DNS port of SkyDNS's DNS endpoint (defaults to env. var. SKYDNS_DNSPORT or 53)"},
		cli.StringFlag{"dnsdomain",
			func() string {
				x := os.Getenv("SKYDNS_DNSDOMAIN")
				if x == "" {
					x = "skydns.local"
				}
				return x
			}(), "DNS domain of SkyDNS (defaults to env. var. SKYDNS_DNSDOMAIN or skydns.local)"},
		cli.StringFlag{"secret", "", "secret to authenticate with"},
	}

	app.Commands = []cli.Command{
		{
			Name:   "list",
			Usage:  "list a service from skydns",
			Action: getAction,
			Flags:  []cli.Flag{cli.BoolFlag{"d", "use DNS instead of HTTP"}},
		},
		{
			Name:   "add",
			Usage:  "add a new service to skydns",
			Action: addAction,
		},
		{
			Name:   "delete",
			Usage:  "delete a service from skydns",
			Action: deleteAction,
		},
		{
			Name:   "update",
			Usage:  "update a service's ttl in skydns",
			Action: updateAction,
		},
	}
}
开发者ID:rpeterson,项目名称:skydns,代码行数:50,代码来源:main.go

示例9: setCommands

// Set application commands
func setCommands(app *cli.App, config *configuration) {
	app.Commands = []cli.Command{
		{
			Name:    "checkout",
			Aliases: []string{"co"},
			Usage:   "Checkout branch",
			Flags: []cli.Flag{
				cli.BoolFlag{
					Name:  "b",
					Usage: "Create new branch while checkout",
				},
			},
			Action: func(c *cli.Context) {
				valid := validateConfiguration(config)
				if !valid {
					fmt.Println(errorDecorator("Please provide valid configuration"))
					os.Exit(1)
				}
				checkoutBranch(c, config)
			},
		},
		{
			Name:    "version",
			Aliases: []string{"v"},
			Usage:   "Get version issues",
			Action: func(c *cli.Context) {
				valid := validateConfiguration(config)
				if !valid {
					fmt.Println(errorDecorator("Please provide valid configuration"))
					os.Exit(1)
				}
				getVersionIssues(c, config)
			},
		},
		{
			Name:    "description",
			Aliases: []string{"d"},
			Usage:   "Show issue description",
			Action: func(c *cli.Context) {
				valid := validateConfiguration(config)
				if !valid {
					fmt.Println(errorDecorator("Please provide valid configuration"))
					os.Exit(1)
				}
				showIssueDetails(c, config)
			},
		},
	}
}
开发者ID:Rentlio,项目名称:jit,代码行数:50,代码来源:jit.go

示例10: Register

//import "encoding/json"
// maybe pass in a points to Commands, so we can register
// subcommands? Or a register module to do the registering.
func Register(app *cli.App) string {
	app.Commands = []cli.Command{
		{
			Name: "cloudformation",
			Subcommands: []cli.Command{
				{
					Name:   "follow-stack-events",
					Usage:  "NAME...",
					Action: followStackEvents,
				},
			},
		},
	}
	return "Finished"
}
开发者ID:braidenjudd,项目名称:awsx,代码行数:18,代码来源:followStackEvents.go

示例11: AddToCLI

func AddToCLI(a *cli.App) {
	commands := []cli.Command{
		{
			Name:    "ec2",
			Usage:   "find EC2 instances that match a regex",
			Aliases: []string{"e"},
			Subcommands: []cli.Command{
				{
					Name:    "match",
					Aliases: []string{"m"},
					Usage:   "find EC2 instances that match a regex",
					Action:  Match,
				},
			},
		},
	}

	a.Commands = append(a.Commands, commands...)
}
开发者ID:mostlygeek,项目名称:awstk,代码行数:19,代码来源:cli.go

示例12: setupCommands

func setupCommands(app *cli.App) {
	app.Commands = []cli.Command{
		{
			Name:    "signature",
			Aliases: []string{"s"},
			Usage: "Signature generate use blake2 algorithm\n" +
				"     -b, --block-size=BYTES    Signature block size\n" +
				"     -s, --sum-size=BYTES      Set signature strength\n",
			Flags: []cli.Flag{
				cli.IntFlag{
					Name:  "block-size,b",
					Value: 2048,
					Usage: "Set signature block size",
				},
				cli.IntFlag{
					Name:  "sum-size,s",
					Value: 32,
					Usage: "Set signature strong checksum strength, 32 or 64",
				},
			},
			Action: doSign,
		},
		{
			Name:    "delta",
			Aliases: []string{"d"},
			Usage: "Delta-encoding options:\n" +
				"     -b, --block-size=BYTES    Signature block size\n" +
				"     -s, --sum-size=BYTES      Set signature strength\n",

			Action: doDelta,
		},
		{
			Name:    "patch",
			Aliases: []string{"p"},
			Usage: "complete a task on the list\n" +
				"     -b, --block-size=BYTES    Signature block size\n" +
				"     -s, --sum-size=BYTES      Set signature strength\n",

			Action: doPatch,
		},
	}
}
开发者ID:smtc,项目名称:rsync,代码行数:42,代码来源:rdiff.go

示例13: initCommands

func initCommands(app *gcli.App) {
	app.Commands = []gcli.Command{
		createAlertCommand(),
		getAlertCommand(),
		attachFileCommand(),
		acknowledgeCommand(),
		renotifyCommand(),
		takeOwnershipCommand(),
		assignOwnerCommand(),
		addTeamCommand(),
		addRecipientCommand(),
		addTagsCommand(),
		addNoteCommand(),
		executeActionCommand(),
		closeAlertCommand(),
		deleteAlertCommand(),
		heartbeatCommand(),
		enableCommand(),
		disableCommand(),
	}
}
开发者ID:smcavoy-travelbird,项目名称:opsgenie-lamp,代码行数:21,代码来源:lamp.go

示例14: setupClusterCommand

func setupClusterCommand(app *cli.App) {
	app.Commands = append(
		app.Commands,
		cli.Command{
			Name:     "cluster",
			Aliases:  []string{"c"},
			Usage:    "get information about the connected cluster",
			Action:   cli.ShowSubcommandHelp,
			HideHelp: true,
			Subcommands: []cli.Command{
				cli.Command{
					Name:    "health",
					Aliases: []string{"h"},
					Usage:   "get health information about the cluster",
					Action:  getClusterHealth,
				},
				cli.Command{
					Name:    "stats",
					Aliases: []string{"s"},
					Usage:   "get cluster-wide statistics, including indices, storage and nodes",
					Action:  getClusterStats,
				},
				cli.Command{
					Name:    "nodes",
					Aliases: []string{"n"},
					Usage:   "get information on the nodes in the cluster",
					Action:  getClusterNodes,
				},
				cli.Command{
					Name:        "update",
					Aliases:     []string{"u"},
					Usage:       "update the cluster settings via JSON",
					Description: "esu cluster update [PATH] -- Where PATH is a JSON document to update with. Alternatively, JSON can be piped into this command",
					Action:      putClusterSettings,
				},
			},
		},
	)
}
开发者ID:rodaine,项目名称:esu,代码行数:39,代码来源:cluster.go

示例15:

				Expect(fakeExitHandler.ExitCalledWith).To(Equal([]int{1}))
			})
		})

		Describe("App.Before", func() {
			Context("when running the target command", func() {
				It("does not verify the current target", func() {
					cliConfig.SetTarget("my-lattice.example.com")
					Expect(cliConfig.Save()).To(Succeed())

					commandRan := false

					cliApp.Commands = []cli.Command{
						cli.Command{
							Name: "target",
							Action: func(ctx *cli.Context) {
								commandRan = true
							},
						},
					}

					Expect(cliApp.Run([]string{"ltc", "target"})).To(Succeed())
					Expect(commandRan).To(BeTrue())
					Expect(fakeTargetVerifier.VerifyTargetCallCount()).To(Equal(0))
				})
			})

			Context("when running the help command", func() {
				It("does not verify the current target", func() {
					cliConfig.SetTarget("my-lattice.example.com")
					Expect(cliConfig.Save()).To(Succeed())
开发者ID:edwardt,项目名称:lattice,代码行数:31,代码来源:cli_app_factory_test.go


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