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


Golang App.Name方法代码示例

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


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

示例1: setBasicInfos

func setBasicInfos(app *cli.App, appName string, version string) {
	app.Name = appName
	app.Version = version
	app.Usage = "Focus on your tasks and let your code flow."
	t := time.Now()
	app.Copyright = "TechMantra - " + strconv.Itoa(t.Year())
}
开发者ID:TechMantra,项目名称:focus,代码行数:7,代码来源:cli.go

示例2: describeApp

func describeApp(app *cli.App, version string) {
	app.Name = "init-exporter"
	app.Usage = "exports services described by Procfile to systemd"
	app.Version = version

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:  "n, appname",
			Usage: "Application name (This name only affects the names of generated files)",
		},
		cli.BoolFlag{
			Name:  "c, uninstall",
			Usage: "Remove scripts and helpers for a particular application",
		},
		cli.StringFlag{
			Name:  "config",
			Value: defaultConfigPath,
			Usage: "path to configuration file",
		},
		cli.StringFlag{
			Name:  "p, procfile",
			Usage: "path to procfile",
		},
		cli.StringFlag{
			Name:  "f, format",
			Usage: "Format of init files (upstart | systemd)",
		},
	}
}
开发者ID:miros,项目名称:init-exporter,代码行数:29,代码来源:init-exporter.go

示例3: 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

示例4: main

func main() {
	var app *cli.App
	app = cli.NewApp()
	app.Name = "awsutils"
	app.Usage = "automation of Amazon Web Services configurations through their API"
	app.EnableBashCompletion = true
	app.Commands = []cli.Command{
		{
			Name:  "iam",
			Usage: "use the AWS iam API",
			Subcommands: []cli.Command{
				{
					Name:  "certs",
					Usage: "summarise certificate configurations available in your AWS account",
					Action: func(c *cli.Context) {
						out, err := exec.Command("aws", "iam", "list-server-certificates").Output()
						if err != nil {
							fmt.Println(err.Error())
							return
						}

						var r ListServerCertificatesResponse
						err = json.Unmarshal(out, &r)
						if err != nil {
							fmt.Println(err.Error())
							return
						}

						w := tabwriter.NewWriter(os.Stdout, 0, 4, 3, ' ', 0)
						fmt.Fprint(w, "ID\tName\tStatus\n")
						for _, cm := range r.ServerCertificateMetadataList {
							fmt.Fprintf(w, "%s\t%s\t%s\n", cm.ServerCertificateID, cm.ServerCertificateName, ResolveStatus(cm.Expiration))
						}
						w.Flush()
						// fmt.Printf("%+v\n", r)
					},
				},
			},
		},
		{
			Name:    "cloudfront",
			Aliases: []string{"cf"},
			Usage:   "use the AWS cloudfront API",
			Subcommands: []cli.Command{
				{
					Name:  "export-configs",
					Usage: "export the cloudfront distribution configurations",
					Action: func(c *cli.Context) {
						out, err := exec.Command("aws", "cloudfront", "list-distributions").Output()
						if err != nil {
							fmt.Println(err.Error())
							return
						}

						var r CloudFrontListDistributionsResponse
						err = json.Unmarshal(out, &r)
						if err != nil {
							fmt.Println(err.Error())
							return
						}

						w := tabwriter.NewWriter(os.Stdout, 0, 4, 3, ' ', 0)
						fmt.Fprint(w, "DomainName\n")
						for _, d := range r.Distributionlist.Items {
							fmt.Fprintf(w, "%+v\n", d.Origins.Items[0]["DomainName"])
							json, _ := json.MarshalIndent(d, "", "  ")

							fn := fmt.Sprintf("%s.json", d.Origins.Items[0]["Id"])
							f, err := os.Create(fn)
							if err != nil {
								cwd, _ := os.Getwd()
								fmt.Printf("Unable to create file '%s' in '%s'", fn, cwd)
								continue
							}
							f.Write(json)
							f.Close()
						}
						w.Flush()
					},
				},
				{
					Name:  "dists",
					Usage: "summarize the cloudfront distribution configurations",
					Flags: []cli.Flag{
						cli.StringFlag{
							Name:  "order-by",
							Value: "alias",
							Usage: "sort results on alias|origin|status",
						},
						cli.BoolFlag{
							Name:  "csv",
							Usage: "output as csv",
						},
					},
					Action: func(c *cli.Context) {
						out, err := exec.Command("aws", "cloudfront", "list-distributions").Output()
						if err != nil {
							fmt.Println(err.Error())
							return
						}
//.........这里部分代码省略.........
开发者ID:bookerzzz,项目名称:awsutils,代码行数:101,代码来源:main.go


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