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

Golang flag.NewFlagSet函数代码示例

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

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



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

示例1: hwaf_make_cmd_asetup

func hwaf_make_cmd_asetup() *commander.Command {
	cmd := &commander.Command{
		Run:       hwaf_run_cmd_asetup,
		UsageLine: "asetup [options] <args>",
		Short:     "setup a workarea with Athena-like defaults",
		Long: `
asetup sets up a workarea with Athena-like defaults.

ex:
 $ mkdir my-work-area && cd my-work-area
 $ hwaf asetup
 $ hwaf asetup mana,20121207
 $ hwaf asetup mana 20121207
 $ hwaf asetup -arch=64    mana 20121207
 $ hwaf asetup -comp=gcc44 mana 20121207
 $ hwaf asetup -os=centos6 mana 20121207
 $ hwaf asetup -type=opt   mana 20121207
 $ hwaf asetup -cmtcfg=x86_64-slc6-gcc44-opt mana 20121207
 $ CMTCFG=x86_64-slc6-gcc44-opt \
   hwaf asetup mana 20121207
`,
		Flag: *flag.NewFlagSet("hwaf-setup", flag.ExitOnError),
	}
	//cmd.Flag.String("p", "", "List of paths to projects to setup against")
	//cmd.Flag.String("cfg", "", "Path to a configuration file")
	cmd.Flag.Bool("v", false, "enable verbose mode")
	cmd.Flag.String("arch", "", "explicit architecture to use (32/64)")
	cmd.Flag.String("comp", "", "explicit compiler name to use (ex: gcc44, clang32,...)")
	cmd.Flag.String("os", "", "explicit system name to use (ex: slc6, slc5, centos6, darwin106,...)")
	cmd.Flag.String("type", "", "explicit build variant to use (ex: opt/dbg)")
	cmd.Flag.String("cmtcfg", "", "explicit CMTCFG value to use")
	return cmd
}
开发者ID:ChristianArnault,项目名称:hwaf,代码行数:33,代码来源:cmd_asetup.go


示例2: RootCommand

// RootCommand creates root command in command tree
func RootCommand() *commander.Command {
	cmd := &commander.Command{
		UsageLine: os.Args[0],
		Short:     "Debian repository management tool",
		Long: `
aptly is a tool to create partial and full mirrors of remote
repositories, manage local repositories, filter them, merge,
upgrade individual packages, take snapshots and publish them
back as Debian repositories.`,
		Flag: *flag.NewFlagSet("aptly", flag.ExitOnError),
		Subcommands: []*commander.Command{
			makeCmdDb(),
			makeCmdGraph(),
			makeCmdMirror(),
			makeCmdRepo(),
			makeCmdServe(),
			makeCmdSnapshot(),
			makeCmdPublish(),
			makeCmdVersion(),
		},
	}

	cmd.Flag.Bool("dep-follow-suggests", false, "when processing dependencies, follow Suggests")
	cmd.Flag.Bool("dep-follow-source", false, "when processing dependencies, follow from binary to Source packages")
	cmd.Flag.Bool("dep-follow-recommends", false, "when processing dependencies, follow Recommends")
	cmd.Flag.Bool("dep-follow-all-variants", false, "when processing dependencies, follow a & b if depdency is 'a|b'")
	cmd.Flag.String("architectures", "", "list of architectures to consider during (comma-separated), default to all available")
	cmd.Flag.String("config", "", "location of configuration file (default locations are /etc/aptly.conf, ~/.aptly.conf)")
	return cmd
}
开发者ID:hdonnay,项目名称:aptly,代码行数:31,代码来源:cmd.go


示例3: hwaf_make_cmd_git_svn_clone

func hwaf_make_cmd_git_svn_clone() *commander.Command {
	cmd := &commander.Command{
		Run:       hwaf_run_cmd_git_svn_clone,
		UsageLine: "svn-clone [options] <URL>",
		Short:     "convert a SVN repository into a GIT one",
		Long: `
svn-clone converts a SVN repository into a GIT one.

ex:
 $ hwaf git svn-clone svn+ssh://svn.cern.ch/atlasoff/Control/AthenaCommon
`,
		Flag: *flag.NewFlagSet("hwaf-git-svn-clone", flag.ExitOnError),
	}
	cmd.Flag.Bool("verbose", false, "")
	cmd.Flag.Bool("metadata", false, "include metadata in git logs (git-svn-id)")
	cmd.Flag.Bool("no-minimize-url", false, "accept URLs as-is without attempting to connect a higher level directory")
	cmd.Flag.Bool("root-is-trunk", false, "use this if the root level of the repo is equivalent to the trunk and there are no tags or branches")
	cmd.Flag.Bool("rebase", false, "instead of cloning a new project, rebase an existing one against SVN")
	cmd.Flag.String("username", "", "username for transports that needs it (http(s), svn)")
	cmd.Flag.String("trunk", "trunk", "subpath to trunk from repository URL")
	cmd.Flag.String("branches", "branches", "subpath to branches from repository URL")
	cmd.Flag.String("tags", "tags", "subpath to tags from repository URL")
	cmd.Flag.String("exclude", "", "regular expression to filter paths when fetching")
	cmd.Flag.String("revision", "", "start importing from SVN revision START_REV; optionally end at END_REV. e.g. -revision START_REV:END_REV")

	cmd.Flag.Bool("no-trunk", false, "do not import anything from trunk")
	cmd.Flag.Bool("no-branches", false, "do not import anything from branches")
	cmd.Flag.Bool("no-tags", false, "do not import anything from tags")
	cmd.Flag.String("authors", "$HOME/.config/go-svn2git/authors", "path to file containing svn-to-git authors mapping")
	return cmd
}
开发者ID:ChristianArnault,项目名称:hwaf,代码行数:31,代码来源:cmd_git_svn_clone.go


示例4: hwaf_make_cmd_pkg_add

func hwaf_make_cmd_pkg_add() *commander.Command {
	cmd := &commander.Command{
		Run:       hwaf_run_cmd_pkg_add,
		UsageLine: "co [options] <pkg-uri> [<local-pkg-name>]",
		Short:     "add a package to the current workarea",
		Long: `
co adds a package to the current workarea.

ex:
 $ hwaf pkg co /foo/pkg
 $ hwaf pkg co Control/AthenaKernel
 $ hwaf pkg co git://github.com/mana-fwk/mana-core-athenakernel
 $ hwaf pkg co git://github.com/mana-fwk/mana-core-athenakernel Control/AthenaKernel
 $ hwaf pkg co -b=rel/mana git://github.com/mana-fwk/mana-core-athenakernel Control/AthenaKernel
 $ hwaf pkg co -b=AthenaKernel-00-00-01 svn+ssh://svn.cern.ch/reps/atlasoff/Control/AthenaKernel Control/AthenaKernel
 $ hwaf pkg co -f=list.of.pkgs.txt
`,
		Flag: *flag.NewFlagSet("hwaf-pkg-co", flag.ExitOnError),
	}
	cmd.Flag.Bool("v", false, "enable verbose output")
	cmd.Flag.String("b", "", "branch to checkout (default=master)")
	cmd.Flag.String("f", "", "path to a file holding a list of packages to retrieve")

	return cmd
}
开发者ID:ChristianArnault,项目名称:hwaf,代码行数:25,代码来源:cmd_pkg_add.go


示例5: ami_make_cmd_cmd

func ami_make_cmd_cmd() *commander.Command {
	cmd := &commander.Command{
		Run:       run_any_cmd,
		UsageLine: "cmd <AmiCommand> <AmiArg0> <AmiArg1>...",
		Short:     "run an arbitrary AMI command",
		Long: `
cmd sends an arbitrary AMI command to the AMI server.

ex:

$ go-ami cmd TCGetPackageInfo fullPackageName="/External/pyAMI" processingStep="production" project="TagCollector" repositoryName="AtlasOfflineRepository"

row=0
  -> computingDescription=0
  -> created=2012-08-31 15:41:53 +0000 UTC
  -> physicsDescription=
  -> archive=0
  -> groupOriginOfPackage=AtlasRelease
  -> fullPackageName=/External/pyAMI
  -> comment=
  -> packageName=pyAMI
  -> repositoryName=AtlasOfflineRepository
  -> path=/External/
  -> softwareDomain=
  -> defaultType=leaf
row=1
 [...]
`,
		Flag: *flag.NewFlagSet("ami-cmd", flag.ExitOnError),
	}
	return cmd
}
开发者ID:sbinet,项目名称:go-ami,代码行数:32,代码来源:cmd.go


示例6: fwk_make_cmd_run

func fwk_make_cmd_run() *commander.Command {
	cmd := &commander.Command{
		Run:       fwk_run_cmd_run,
		UsageLine: "run [options] <config.go> [<config2.go> [...]]",
		Short:     "run a fwk job",
		Long: `
run runs a fwk-based job.

ex:
 $ fwk-app run config.go
 $ fwk-app run config1.go config2.go
 $ fwk-app run ./some-dir
 $ fwk-app run -l=INFO -nprocs=4 -evtmax=-1 config.go
`,
		Flag: *flag.NewFlagSet("fwk-app-run", flag.ExitOnError),
	}

	cmd.Flag.String("o", "", "name of the resulting binary (default=name of parent directory)")
	cmd.Flag.Bool("k", false, "whether to keep the resulting binary after a successful run")

	// flags passed to sub-process
	cmd.Flag.String("l", "INFO", "log level (DEBUG|INFO|WARN|ERROR)")
	cmd.Flag.Int("evtmax", -1, "number of events to process")
	cmd.Flag.Int("nprocs", 0, "number of concurrent events to process")
	cmd.Flag.Bool("cpu-prof", false, "enable CPU profiling")
	return cmd
}
开发者ID:andradeandrey,项目名称:fwk,代码行数:27,代码来源:cmd_run.go


示例7: hwaf_make_cmd_setup

func hwaf_make_cmd_setup() *commander.Command {
	cmd := &commander.Command{
		Run:       hwaf_run_cmd_setup,
		UsageLine: "setup [options] <workarea>",
		Short:     "setup an existing workarea",
		Long: `
setup sets up an existing workarea.

ex:
 $ hwaf setup
 $ hwaf setup .
 $ hwaf setup my-work-area
 $ hwaf setup -p=/opt/sw/mana/mana-core/20121207 my-work-area
 $ hwaf setup -p=/path1:/path2 my-work-area
 $ hwaf setup -cfg=${HWAF_CFG}/usr.cfg my-work-area
 $ hwaf setup -tags=ATLAS,NEED_PYCOOL my-work-area
 $ hwaf setup -variant=x86_64-slc6-gcc47-opt my-work-area
`,
		Flag: *flag.NewFlagSet("hwaf-setup", flag.ExitOnError),
	}
	cmd.Flag.String("p", "", "List of paths to projects to setup against")
	cmd.Flag.String("cfg", "", "Path to a configuration file")
	cmd.Flag.String("pkgdir", "src", "Directory under which to checkout packages")
	cmd.Flag.String("variant", "", "quadruplet (e.g. x86_64-slc6-gcc47-opt) identifying the target to build for")
	cmd.Flag.String("tags", "", "comma-separated list of tags to enable for this build")
	cmd.Flag.Bool("v", false, "enable verbose output")

	return cmd
}
开发者ID:ChristianArnault,项目名称:hwaf,代码行数:29,代码来源:cmd_setup.go


示例8: init

func init() {
	app = &commander.Command{
		UsageLine:   "jupyter",
		Subcommands: nil,
		Flag:        *flag.NewFlagSet("jupyter", flag.ExitOnError),
	}
}
开发者ID:sbinet,项目名称:jupyter,代码行数:7,代码来源:main.go


示例9: main

func main() {

	g_cmd = &commander.Command{
		UsageLine: "go-ami",
		Subcommands: []*commander.Command{
			ami_make_cmd_cmd(),
			ami_make_list_datasets_cmd(),
			ami_make_list_runs_cmd(),
			ami_make_list_projects_cmd(),
			ami_make_setup_auth_cmd(),
		},
		Flag: *flag.NewFlagSet("ami", flag.ExitOnError),
	}
	g_cmd.Flag.Bool("verbose", false, "show verbose output")
	g_cmd.Flag.Bool("debug", false, "show a stack trace")
	g_cmd.Flag.String("format", "text", "format of verbose output")
	g_cmd.Flag.Int("n", 5, "number of concurrent queries")

	//TODO: check the value *is* in the [main,replica] list via a special
	//      flag.Value implementation ?
	g_cmd.Flag.String("server", "main", "set the server (main, replica)")

	err := g_cmd.Flag.Parse(os.Args[1:])
	if err != nil {
		fmt.Printf("**error** %v\n", err)
		os.Exit(1)
	}
	g_ami, err = ami.NewClient(
		g_cmd.Flag.Lookup("verbose").Value.Get().(bool),
		g_cmd.Flag.Lookup("format").Value.Get().(string),
		g_cmd.Flag.Lookup("n").Value.Get().(int),
	)
	server := g_cmd.Flag.Lookup("server").Value.Get().(string)
	if server != "main" && server != "replica" {
		fmt.Printf("**error**. server has to be either 'main' or 'replica' (got: %q)\n", server)
		os.Exit(1)
	}
	ami.EndPointType = server

	args := g_cmd.Flag.Args()

	if g_cmd.Flag.Lookup("verbose").Value.Get().(bool) {
		fmt.Printf("%s: server=%v\n", g_cmd.Name, g_cmd.Flag.Lookup("server").Value)
		fmt.Printf("%s: args=%v\n", g_cmd.Name, args)
	}
	if len(args) > 0 && args[0] != "help" && args[0] != "setup-auth" {
		if err != nil {
			fmt.Printf("**error** could not create ami.Client: %v\n", err)
			if err == ami.ErrAuth {
				fmt.Printf("**error** try running:\n  go-ami setup-auth\n")
			}
			os.Exit(1)
		}
	}
	err = g_cmd.Dispatch(args)
	if err != nil {
		fmt.Printf("**error** %v\n", err)
		os.Exit(1)
	}
}
开发者ID:sbinet,项目名称:go-ami,代码行数:60,代码来源:main.go


示例10: init

func init() {
	g_cmd = &commander.Command{
		UsageLine: "lbpkr",
		Short:     "installs software in MYSITEROOT directory.",
		Subcommands: []*commander.Command{
			lbpkr_make_cmd_check(),
			lbpkr_make_cmd_deps(),
			lbpkr_make_cmd_dep_graph(),
			lbpkr_make_cmd_install(),
			lbpkr_make_cmd_install_project(),
			lbpkr_make_cmd_installed(),
			lbpkr_make_cmd_list(),
			lbpkr_make_cmd_provides(),
			lbpkr_make_cmd_remove(),
			lbpkr_make_cmd_repo_add(),
			lbpkr_make_cmd_repo_ls(),
			lbpkr_make_cmd_repo_rm(),
			lbpkr_make_cmd_rpm(),
			lbpkr_make_cmd_self(),
			lbpkr_make_cmd_update(),
			lbpkr_make_cmd_version(),
		},
		Flag: *flag.NewFlagSet("lbpkr", flag.ContinueOnError),
	}
}
开发者ID:bencouturier,项目名称:lbpkr,代码行数:25,代码来源:main.go


示例11: main

func main() {

	g_cmd = &commander.Commander{
		Name: os.Args[0],
		Commands: []*commander.Command{
			git_make_cmd_create(),
			git_make_cmd_login(),
			git_make_cmd_dl_create(),
			git_make_cmd_dl_ls(),
			git_make_cmd_dl_rm(),
		},
		Flag: flag.NewFlagSet("goctogit", flag.ExitOnError),
	}

	err := g_cmd.Flag.Parse(os.Args[1:])
	if err != nil {
		fmt.Printf("**error** %v\n", err)
		os.Exit(1)
	}

	args := g_cmd.Flag.Args()
	err = g_cmd.Run(args)
	if err != nil {
		fmt.Printf("**error** %v\n", err)
		os.Exit(1)
	}
}
开发者ID:sbinet,项目名称:goctogit,代码行数:27,代码来源:main.go


示例12: init

func init() {
	g_cmd = &commander.Commander{
		Name: os.Args[0],
		Commands: []*commander.Command{
			generate(),
		},
		Flag: flag.NewFlagSet("gobot-cli", flag.ExitOnError),
	}
}
开发者ID:hybridgroup,项目名称:gobot-cli,代码行数:9,代码来源:main.go


示例13: init

func init() {
	g_cmd = &commander.Command{
		UsageLine: "gobot <command>",
		Subcommands: []*commander.Command{
			generate(),
		},
		Flag: *flag.NewFlagSet("gobot", flag.ExitOnError),
	}
}
开发者ID:nordicdyno,项目名称:gobot,代码行数:9,代码来源:main.go


示例14: makeRemoveCmd

func makeRemoveCmd() *commander.Command {
	var removeCmd = &commander.Command{
		Run:       runRemoveCmd,
		UsageLine: "remove <name>",
		Flag:      *flag.NewFlagSet("mezasi-remove", flag.ExitOnError),
	}
	removeCmd.Flag.Bool("yes", false, "")
	return removeCmd
}
开发者ID:kayac,项目名称:go-mezasi,代码行数:9,代码来源:command.go


示例15: makeDestroyCmd

func makeDestroyCmd() *commander.Command {
	var removeCmd = &commander.Command{
		Run:       runDestroyCmd,
		UsageLine: "destroy <subid>",
		Flag:      *flag.NewFlagSet("vultr-destroy", flag.ExitOnError),
	}
	removeCmd.Flag.Bool("yes", false, "")
	return removeCmd
}
开发者ID:uzulla,项目名称:go-vultr,代码行数:9,代码来源:command.go


示例16: init

func init() {
	g_cmd = &commander.Commander{
		Name: os.Args[0],
		Commands: []*commander.Command{
			acvmfs_make_cmd_pkg_create(),
		},
		Flag:       flag.NewFlagSet("acvmfs", flag.ExitOnError),
		Commanders: []*commander.Commander{},
	}
}
开发者ID:sbinet,项目名称:atl-cvmfs,代码行数:10,代码来源:main.go


示例17: init

func init() {
	a2cmd = &commander.Commander{
		Name: os.Args[0],
		Commands: []*commander.Command{
			cmdDisasm,
			cmdDiskConvert,
		},
		Flag: flag.NewFlagSet("a2", flag.ExitOnError),
	}
}
开发者ID:sbinet,项目名称:goapple2,代码行数:10,代码来源:main.go


示例18: init

func init() {
	cmd = &commander.Commander{
		Name:     os.Args[0],
		Commands: []*commander.Command{},
		Flag:     flag.NewFlagSet("aptly", flag.ExitOnError),
		Commanders: []*commander.Commander{
			makeCmdMirror(),
		},
	}
}
开发者ID:sbinet,项目名称:aptly,代码行数:10,代码来源:main.go


示例19: init

func init() {
	app = &commander.Command{
		UsageLine: "gopy",
		Subcommands: []*commander.Command{
			gopyMakeCmdGen(),
			gopyMakeCmdBind(),
		},
		Flag: *flag.NewFlagSet("gopy", flag.ExitOnError),
	}
}
开发者ID:ashrafulratul,项目名称:gopy,代码行数:10,代码来源:main.go


示例20: makeCmdDb

func makeCmdDb() *commander.Command {
	return &commander.Command{
		UsageLine: "db",
		Short:     "manage aptly's internal database and package pool",
		Subcommands: []*commander.Command{
			makeCmdDbCleanup(),
		},
		Flag: *flag.NewFlagSet("aptly-db", flag.ExitOnError),
	}
}
开发者ID:romtastic,项目名称:aptly,代码行数:10,代码来源:cmd_db.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang httpbuf.Buffer类代码示例发布时间:2022-05-23
下一篇:
Golang config.Config类代码示例发布时间: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