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

Golang kingpin.New函数代码示例

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

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



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

示例1: main

func main() {
	app := kingpin.New("minicdn", "Master node which manage slaves")
	app.Flag("cachedir", "Cache file directory").Short('d').Default("cache").ExistingDirVar(&mOpts.CacheDir) //.StringVar(&mOpts.CacheDir)
	app.Flag("secret", "Secret key for server").Short('s').Default("sandy mandy").StringVar(&mOpts.Secret)

	ma := app.Command("master", "CDN Master")
	ma.Flag("addr", "Listen address").Default(":7010").StringVar(&mOpts.ListenAddr)
	ma.Flag("log", "Log file, - for stdout").Short('l').Default("-").StringVar(&mOpts.LogFile)
	ma.Flag("mirror", "Mirror http address, ex: http://t.co/").Required().URLVar(&mOpts.MirrorAddr)

	sa := app.Command("slave", "Slave node")
	sa.Flag("addr", "Listen address").Default(":7020").StringVar(&sOpts.ListenAddr)
	sa.Flag("maddr", "Master server address, ex: localhost:7010").Short('m').Required().URLVar(&sOpts.MasterAddr)

	app.Version(VERSION).Author("codeskyblue")
	app.HelpFlag.Short('h')
	app.VersionFlag.Short('v')
	kingpin.CommandLine.Help = "The very simple and mini CDN"

	// parse command line
	cmdName := kingpin.MustParse(app.Parse(os.Args[1:]))

	sOpts.CacheDir = mOpts.CacheDir
	sOpts.Secret = mOpts.Secret

	switch cmdName {
	case ma.FullCommand():
		runMaster(mOpts)
	case sa.FullCommand():
		runSlave(sOpts)
	default:
		log.Fatalf("Unknown command: %s", cmdName)
	}
}
开发者ID:foxundermoon,项目名称:minicdn,代码行数:34,代码来源:main.go


示例2: New

func New(info info.Info, client api.Client, out io.Writer, err io.Writer) (c Command) {
	c.Client = client
	c.Out = out
	c.Error = err

	c.Application = kingpin.New("qiitactl", "Command line interface to manage the posts in Qiita.")
	c.Application.Version(info.Version)
	c.Application.Author(info.Author)
	c.GlobalOptions = GlobalOptions{
		Debug: c.Application.Flag("debug", "Enable debug mode.").Bool(),
	}

	c.Generate = c.Application.Command("generate", "Generate something in your local.")
	c.GenerateFile = c.Generate.Command("file", "Generate a new markdown file for a new post.")
	c.GenerateFileRunner = GenerateFileRunner{
		Title: c.GenerateFile.Arg("title", "The title of a new post.").Required().String(),
		Team:  c.GenerateFile.Flag("team", "The name of a team, when you post to the team.").Short('t').String(),
	}

	c.Create = c.Application.Command("create", "Create resources from current working directory to Qiita.")
	c.CreatePost = c.Create.Command("post", "Create a post in Qiita.")
	c.CreatePostRunner = CreatePostRunner{
		File:  c.CreatePost.Arg("filename", "The filename of the post to be created").Required().File(),
		Tweet: c.CreatePost.Flag("tweet", "Tweet the created post in Twitter.").Short('t').Bool(),
		Gist:  c.CreatePost.Flag("gist", "Post codes in the created post to GitHub Gist.").Short('g').Bool(),
	}

	c.Show = c.Application.Command("show", "Display resources.")
	c.ShowPost = c.Show.Command("post", "Display detail of a post in Qiita.")
	c.ShowPostRunner = ShowPostRunner{
		ID:   c.ShowPost.Flag("id", "The ID of the post to be printed detail.").Short('i').String(),
		File: c.ShowPost.Flag("filename", "The filename of the post to be created.").Short('f').File(),
	}
	c.ShowPosts = c.Show.Command("posts", "Display posts in Qiita.")
	c.ShowPostsRunner = ShowPostsRunner{}

	c.Fetch = c.Application.Command("fetch", "Download resources from Qiita to current working directory.")
	c.FetchPost = c.Fetch.Command("post", "Download a post as a file.")
	c.FetchPostRunner = FetchPostRunner{
		ID:   c.FetchPost.Flag("id", "The ID of the post to be downloaded.").Short('i').String(),
		File: c.FetchPost.Flag("filename", "The filename of the post to be created.").Short('f').File(),
	}
	c.FetchPosts = c.Fetch.Command("posts", "Download posts as files.")
	c.FetchPostsRunner = FetchPostsRunner{}

	c.Update = c.Application.Command("update", "Update resources from current working directory to Qiita.")
	c.UpdatePost = c.Update.Command("post", "Update a post in Qiita.")
	c.UpdatePostRunner = UpdatePostRunner{
		File: c.UpdatePost.Arg("filename", "The filename of the post to be updated.").Required().File(),
	}

	c.Delete = c.Application.Command("delete", "Delete resources from current working directory to Qiita.")
	c.DeletePost = c.Delete.Command("post", "Delete a post in Qiita.")
	c.DeletePostRunner = DeletePostRunner{
		File: c.DeletePost.Arg("filename", "The filename of the post to be deleted.").Required().File(),
	}

	return
}
开发者ID:minodisk,项目名称:qiitactl,代码行数:59,代码来源:command.go


示例3: get

func get(root, cwd client.Fid, cmdline string) (client.Fid, error) {
	args, err := parseCommandLine(cmdline)
	if err != nil {
		return cwd, err
	}
	cmd := kingpin.New("get", "")
	remote := cmd.Arg("remote", "remote filename").Required().String()
	local := cmd.Arg("local", "local filename").Required().String()
	_, err = cmd.Parse(args)
	if err != nil {
		return cwd, err
	}

	remotepath, absolute := parsepath(*remote)
	lf, err := os.Create(*local)
	if err != nil {
		return cwd, err
	}

	f := cwd
	if absolute {
		f = root
	}
	f, _, err = f.Walk(remotepath)
	if err != nil {
		return cwd, err
	}
	defer f.Clunk()

	stat, err := f.Stat()
	if err != nil {
		return cwd, err
	}
	if stat.Mode&qp.DMDIR != 0 {
		return cwd, errors.New("file is a directory")
	}
	_, _, err = f.Open(qp.OREAD)
	if err != nil {
		return cwd, err
	}

	fmt.Fprintf(os.Stderr, "Downloading: %s to %s [%dB]", *remote, *local, stat.Length)
	wf := client.WrappedFid{Fid: f}
	strs, err := wf.ReadAll()
	if err != nil {
		return cwd, err
	}
	fmt.Fprintf(os.Stderr, " - Downloaded %dB.\n", len(strs))
	for len(strs) > 0 {
		n, err := lf.Write(strs)
		if err != nil {
			return cwd, err
		}
		strs = strs[n:]
	}

	return cwd, nil
}
开发者ID:joushou,项目名称:qptools,代码行数:58,代码来源:main.go


示例4: main

func main() {
	app := kingpin.New("Cache", "A generic cache control system")

	configureCmdList(app)
	configureCmdRestore(app)
	configureCmdSnapshot(app)

	kingpin.MustParse(app.Parse(os.Args[1:]))
}
开发者ID:previousnext,项目名称:cache,代码行数:9,代码来源:main.go


示例5: put

func put(root, cwd client.Fid, cmdline string) (client.Fid, error) {
	args, err := parseCommandLine(cmdline)
	if err != nil {
		return cwd, err
	}
	cmd := kingpin.New("put", "")
	local := cmd.Arg("local", "local filename").Required().String()
	remote := cmd.Arg("remote", "remote filename").Required().String()
	_, err = cmd.Parse(args)
	if err != nil {
		return cwd, err
	}

	strs, err := ioutil.ReadFile(*local)
	if err != nil {
		return cwd, err
	}

	remotepath, absolute := parsepath(*remote)
	if len(remotepath) == 0 {
		return cwd, errors.New("need a destination")
	}
	f := cwd
	if absolute {
		f = root
	}
	f, _, err = f.Walk(remotepath[:len(remotepath)-1])
	if err != nil {
		return cwd, err
	}
	defer f.Clunk()

	_, _, err = f.Create(remotepath[len(remotepath)-1], 0666, qp.OWRITE)
	if err != nil {
		f, _, err = f.Walk(remotepath[len(remotepath)-1:])
		if err != nil {
			return cwd, err
		}
		defer f.Clunk()

		_, _, err := f.Open(qp.OTRUNC | qp.OWRITE)
		if err != nil {
			return cwd, err
		}
	}

	wf := &client.WrappedFid{Fid: f}
	fmt.Fprintf(os.Stderr, "Uploading: %s to %s [%dB]", *local, *remote, len(strs))
	_, err = wf.WriteAt(strs, 0)
	if err != nil {
		return cwd, err
	}

	return cwd, nil
}
开发者ID:joushou,项目名称:qptools,代码行数:55,代码来源:main.go


示例6: main

func main() {
	app := kingpin.New("completion", "My application with bash completion.")
	app.Flag("flag-1", "").String()
	app.Flag("flag-2", "").HintOptions("opt1", "opt2").String()

	configureNetcatCommand(app)

	// Add some additional top level commands
	addSubCommand(app, "ls", "Additional top level command to show command completion")
	addSubCommand(app, "ping", "Additional top level command to show command completion")
	addSubCommand(app, "nmap", "Additional top level command to show command completion")

	kingpin.MustParse(app.Parse(os.Args[1:]))
}
开发者ID:nickschuch,项目名称:metrics,代码行数:14,代码来源:main.go


示例7: New

func New(args []string) (o Options, err error) {
	app := kingpin.New("presigner", "Publisher of signed URLs to upload files directly to Google Cloud Storage")
	i := app.Flag("id", "Google Access ID").Short('i').OverrideDefaultFromEnvar("GOOGLE_ACCESS_ID").Required().String()
	k := app.Flag("key", "Path to private key").Short('k').OverrideDefaultFromEnvar("PRIVATE_KEY_PATH").Required().String()
	b := app.Flag("buckets", "Allowed buckets").Short('b').Default("*").OverrideDefaultFromEnvar("BUCKETS").String()
	p := app.Flag("port", "Listening port").Short('p').Default("80").OverrideDefaultFromEnvar("PORT").Int()
	d := app.Flag("duration", "Available duration of published signature").Short('d').Default("1m").Duration()
	_, err = app.Parse(args)
	if err != nil {
		return
	}

	o.GoogleAccessID = *i
	o.PrivateKeyPath = *k
	o.Buckets = NewBuckets(*b)
	o.Port = *p
	o.Duration = *d
	return
}
开发者ID:go-microservices,项目名称:presigner,代码行数:19,代码来源:options.go


示例8: New

func New(args []string) (o Options, err error) {
	app := kingpin.New("policies", "Publisher of POST policies to upload files directly to Amazon S3")
	i := app.Flag("id", "AWS access key ID").Short('i').OverrideDefaultFromEnvar("AWS_ACCESS_KEY_ID").Required().String()
	s := app.Flag("secret", "AWS secret access key").Short('s').OverrideDefaultFromEnvar("AWS_SECRET_ACCESS_KEY").Required().String()
	r := app.Flag("region", "AWS region").Short('r').OverrideDefaultFromEnvar("AWS_REGION").Required().String()
	b := app.Flag("bucket", "AWS S3 bucket name").Short('b').OverrideDefaultFromEnvar("AWS_BUCKET").Required().String()
	p := app.Flag("port", "Listening port").Short('p').Default("80").Int()
	d := app.Flag("duration", "Available duration of published signature").Short('d').Default("1m").Duration()
	_, err = app.Parse(args)
	if err != nil {
		return
	}

	o.AccessKeyID = *i
	o.SecretAccessKey = *s
	o.Region = *r
	o.Bucket = *b
	o.Port = *p
	o.Duration = *d
	return
}
开发者ID:go-microservices,项目名称:policies,代码行数:21,代码来源:options.go


示例9: New

func New(args []string) (o Options, err error) {
	app := kingpin.New("resizer", "Image resizing processor.")

	ProjectID := app.Flag("id", "Project ID of Google Cloud Platform").OverrideDefaultFromEnvar("RESIZER_PROJECT_ID").Required().String()
	Bucket := app.Flag("bucket", "Bucket of Google Cloud Storage").OverrideDefaultFromEnvar("RESIZER_BUCKET").Required().String()
	JSON := app.Flag("json", "Path to json of service account for Google Cloud Platform").OverrideDefaultFromEnvar("RESIZER_JSON").Required().String()
	DBUser := app.Flag("dbuser", "Database user name").OverrideDefaultFromEnvar("RESIZER_DB_USER").Required().String()
	DBPassword := app.Flag("dbpassword", "Database password").OverrideDefaultFromEnvar("RESIZER_DB_PASSWORD").Default("").String()
	DBProtocol := app.Flag("dbprotocol", "Database access protocol").OverrideDefaultFromEnvar("RESIZER_DB_PROTOCOL").Required().String()
	DBAddress := app.Flag("dbaddress", "Database address").OverrideDefaultFromEnvar("RESIZER_DB_ADDRESS").Required().String()
	DBName := app.Flag("dbname", "Database name").OverrideDefaultFromEnvar("RESIZER_DB_NAME").Required().String()
	FlagHosts := app.Flag("host", "Allowed host").Strings()
	MaxConn := app.Flag("maxconn", "Max number of current connections").OverrideDefaultFromEnvar("RESIZER_MAX_CONNECTION").Default("10").Int()

	_, err = app.Parse(args)
	if err != nil {
		return
	}

	var Hosts *[]string
	if *FlagHosts == nil {
		SplitedHosts := strings.Split(os.Getenv("RESIZER_HOSTS"), ",")
		Hosts = &SplitedHosts
	} else {
		Hosts = FlagHosts
	}

	return Options{
		ProjectID:  *ProjectID,
		Bucket:     *Bucket,
		JSON:       *JSON,
		DBUser:     *DBUser,
		DBPassword: *DBPassword,
		DBProtocol: *DBProtocol,
		DBAddress:  *DBAddress,
		DBName:     *DBName,
		Hosts:      *Hosts,
		MaxConn:    *MaxConn,
	}, nil
}
开发者ID:go-microservices,项目名称:resizer,代码行数:40,代码来源:options.go


示例10: stuff

func stuff(root, cwd client.Fid, cmdline string) (client.Fid, error) {
	args, err := parseCommandLine(cmdline)
	if err != nil {
		return cwd, err
	}

	cmd := kingpin.New("stuff", "")
	content := cmd.Arg("content", "the string to stuff").Required().String()
	target := cmd.Arg("target", "the file to stuff it into").Required().String()
	_, err = cmd.Parse(args)
	if err != nil {
		return cwd, err
	}

	remotepath, absolute := parsepath(*target)
	if len(remotepath) == 0 {
		return cwd, errors.New("need a destination")
	}

	f := cwd
	if absolute {
		f = root
	}
	f, _, err = f.Walk(remotepath)
	if err != nil {
		return cwd, err
	}
	defer f.Clunk()

	_, _, err = f.Open(qp.OWRITE)
	if err != nil {
		return cwd, err
	}

	wf := &client.WrappedFid{Fid: f}
	_, err = wf.WriteAt([]byte(*content), 0)

	return cwd, err
}
开发者ID:joushou,项目名称:qptools,代码行数:39,代码来源:main.go


示例11:

import (
	"fmt"
	"os"
	"strings"

	"github.com/alecthomas/kingpin"
)

// Version for crane
const Version = "v2.8.0"

var cfg Config
var allowed []string

var (
	app         = kingpin.New("crane", "Lift containers with ease").Interspersed(false).DefaultEnvars()
	verboseFlag = app.Flag("verbose", "Enable verbose output.").Short('v').Bool()
	configFlag  = app.Flag(
		"config",
		"Location of config file.",
	).Short('c').PlaceHolder("~/crane.yaml").String()
	prefixFlag = app.Flag(
		"prefix",
		"Container prefix.",
	).Short('p').String()
	excludeFlag = app.Flag(
		"exclude",
		"Exclude group or container. Can be repeated.",
	).Short('e').PlaceHolder("container|group").Strings()
	onlyFlag = app.Flag(
		"only",
开发者ID:bivas,项目名称:crane,代码行数:31,代码来源:cli.go


示例12:

	"reflect"
	"regexp"
	"strconv"
	"strings"

	"github.com/alecthomas/kingpin"
	"github.com/inconshreveable/log15"
	"github.com/mattn/go-colorable"
	"github.com/rightscale/rsc/cm15"
	"github.com/rightscale/rsc/httpclient"
	"github.com/rightscale/rsc/log"
	"github.com/rightscale/rsc/rsapi"
)

var (
	app        = kingpin.New("right_st", "A command-line application for managing RightScripts")
	debug      = app.Flag("debug", "Debug mode").Short('d').Bool()
	configFile = app.Flag("config", "Set the config file path.").Short('c').Default(DefaultConfigFile()).String()
	account    = app.Flag("account", "RightScale account name to use").Short('a').String()

	// ----- ServerTemplates -----
	stCmd = app.Command("st", "ServerTemplate")

	stShowCmd        = stCmd.Command("show", "Show a single ServerTemplate")
	stShowNameOrHref = stShowCmd.Arg("name|href|id", "ServerTemplate Name or HREF or Id").Required().String()

	stUploadCmd    = stCmd.Command("upload", "Upload a ServerTemplate specified by a YAML document")
	stUploadPaths  = stUploadCmd.Arg("path", "File or directory containing script files to upload").Required().ExistingFilesOrDirs()
	stUploadPrefix = stUploadCmd.Flag("prefix", "Create dev/test version by adding prefix to name of all ServerTemplate and RightScripts uploaded").Short('x').String()

	stDeleteCmd    = stCmd.Command("delete", "Delete dev/test ServerTemplates and RightScripts with a prefix")
开发者ID:rightscale,项目名称:right_st,代码行数:31,代码来源:main.go


示例13: main

func main() {
	// Define the command-line structure using Kingpin
	var versionString = fmt.Sprintf("ceftools v%v.%v (C) 2015 Sten Linnarsson <http://linnarssonlab.org/>", ceftools.MajorVersion, ceftools.MinorVersion)

	var app = kingpin.New("cef", versionString)
	var app_bycol = app.Flag("bycol", "Apply command by columns instead of by rows").Short('c').Bool()
	var app_profile = app.Flag("profile", "Run with CPU profiling, output to the given file").String()

	var info = app.Command("info", "Show a summary of the file contents")
	var test = app.Command("test", "Perform an internal test")
	var transpose = app.Command("transpose", "Transpose rows and columns")
	var cmdimport = app.Command("import", "Import from a legacy format")
	var import_format = cmdimport.Flag("format", "The file format to expect ('strt')").Required().Short('f').String()

	var rename = app.Command("rename", "Rename attribute")
	var rename_attr = rename.Flag("attr", "The attribute to rename ('old=new')").Required().Short('c').String()

	var drop = app.Command("drop", "Remove attributes")
	var drop_attrs = drop.Flag("attrs", "Row attribute(s) to remove (case-sensitive, comma-separated)").Short('a').String()
	var drop_headers = drop.Flag("headers", "Headers to remove (case-sensitive, comma-separated)").Short('h').String()
	var drop_except = drop.Flag("except", "Keep the given attributes instead of dropping them ").Bool()

	var add = app.Command("add", "Add header or row attribute")
	var add_header = add.Flag("header", "Header to add, in the form 'name=value'").Short('h').String()
	var add_attr = add.Flag("attr", "Attribute to add, in the form 'name=value' (value can be '(row)')").Short('a').String()

	var cmdselect = app.Command("select", "Select rows that match criteria (and drop the rest)")
	var select_range = cmdselect.Flag("range", "Select a range of rows (like '10:90')").String()
	var select_where = cmdselect.Flag("where", "Select rows with specific value for attribute ('attr=value')").String()
	var select_except = cmdselect.Flag("except", "Invert selection").Bool()

	var rescale = app.Command("rescale", "Rescale values by rows")
	var rescale_method = rescale.Flag("method", "Method to use (log, tpm or rpkm)").Short('m').Required().Enum("log", "tpm", "rpkm")
	var rescale_length = rescale.Flag("length", "Indicate the name of the attribute that gives gene length (for RPKM)").String()

	var join = app.Command("join", "Join two files based on given attributes")
	var join_other = join.Flag("with", "The file to which the input should be joined").Required().String()
	var join_on = join.Flag("on", "The attributes on which to join, of form 'attr1=attr2'").Required().String()

	var sort = app.Command("sort", "Sort by row attribute or by specific column")
	var sort_by = sort.Flag("by", "The attribute or column ('column=value') to sort by").String()
	var sort_reverse = sort.Flag("reverse", "Sort in reverse order").Short('r').Bool()
	var sort_numerical = sort.Flag("numerical", "Numerical sort (default: alphabetical)").Short('n').Bool()
	var sort_spin = sort.Flag("spin", "Sort by SPIN").Bool()
	var sort_corrfile = sort.Flag("corrfile", "Optional filename where to write the sorted correlation matrix").String()

	var aggregate = app.Command("aggregate", "Calculate aggregate statistics per row")
	var aggregate_cv = aggregate.Flag("cv", "Calculate coefficient of variation (CV)").Bool()
	var aggregate_mean = aggregate.Flag("mean", "Calculate mean").Bool()
	var aggregate_stdev = aggregate.Flag("stdev", "Calculate standard deviation").Bool()
	var aggregate_max = aggregate.Flag("max", "Calculate max value").Bool()
	var aggregate_min = aggregate.Flag("min", "Calculate min value").Bool()
	var aggregate_noise = aggregate.Flag("noise", "Calculate noise (CV-vs-mean offset)").Required().Enum("std", "bands")

	var view = app.Command("view", "View the file content interactively")

	// Parse the command line
	var parsed, err = app.Parse(os.Args[1:])
	if err != nil {
		app.Usage(os.Stderr)
		return
	}

	if *app_profile != "" {
		f, err := os.Create(*app_profile)
		if err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()

	}

	// Handle the sub-commands
	switch kingpin.MustParse(parsed, nil) {
	case view.FullCommand():
		if err = ceftools.Viewer(*app_bycol); err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		return
	case aggregate.FullCommand():
		if err = ceftools.CmdAggregate(*aggregate_mean, *aggregate_cv, *aggregate_stdev, *aggregate_max, *aggregate_min, *aggregate_noise, *app_bycol); err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		return
	case rename.FullCommand():
		if err = ceftools.CmdRename(*rename_attr, *app_bycol); err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		return
	case add.FullCommand():
		if err = ceftools.CmdAdd(*add_attr, *add_header, *app_bycol); err != nil {
			fmt.Fprintln(os.Stderr, err)
		}
		return
	case sort.FullCommand():
		if *sort_spin {
			if err = ceftools.CmdSPIN(*sort_corrfile, *app_bycol); err != nil {
				fmt.Fprintln(os.Stderr, err)
			}
//.........这里部分代码省略.........
开发者ID:hsmorikawa,项目名称:ceftools,代码行数:101,代码来源:cef.go


示例14: dispatch

package main

import (
	"fmt"
	"os"

	"github.com/alecthomas/kingpin"
)

var (
	app = kingpin.New("apec", "BNP Paribas reports crawler and charter")
)

func dispatch() error {
	cmd := kingpin.MustParse(app.Parse(os.Args[1:]))
	switch cmd {
	case parseCmd.FullCommand():
		return parseFn()
	case webCmd.FullCommand():
		return webFn()
	}
	return nil
}

func main() {
	err := dispatch()
	if err != nil {
		fmt.Fprintf(os.Stderr, "error: %s\n", err)
		os.Exit(1)
	}
}
开发者ID:pmezard,项目名称:bnp,代码行数:31,代码来源:bnp.go


示例15:

package main

import (
	"log"
	"os"
	"runtime"
	"runtime/pprof"

	"github.com/alecthomas/kingpin"
)

var (
	app     = kingpin.New("pcorr", "A command-line application for correlation calculation.")
	debug   = app.Flag("debug", "Enable debug mode.").Bool()
	ncpu    = app.Flag("ncpu", "number of CPUs for using").Default("1").Int()
	profile = app.Flag("profile", "cpu and heap profile file").Default("").String()

	pileupApp       = app.Command("pileup", "pileup reads")
	pileupMinBQ     = pileupApp.Flag("min-BQ", "minimum base quality").Short('Q').Default("13").Int()
	pileupMinMQ     = pileupApp.Flag("min-MQ", "minimum mapping quality").Short('q').Default("0").Int()
	pileupOutFile   = pileupApp.Flag("outfile", "output file").Short('o').Default("").String()
	pileupFastaFile = pileupApp.Flag("fastafile", "genome fasta file").Short('f').Default("").String()
	pileupBamFile   = pileupApp.Arg("bamfile", "bam file of reads").Required().String()

	piApp         = app.Command("pi", "calculate pi")
	piMinBQ       = piApp.Flag("min-BQ", "minimum base quality").Short('Q').Default("13").Int()
	piMinCoverage = piApp.Flag("min-coverage", "minimum base coverage").Short('c').Default("10").Int()
	piFormat      = piApp.Flag("pileup-formate", "pileup formate").Short('F').Default("tab").String()
	piOutFile     = piApp.Flag("output", "output file").Short('o').Default("").String()
	piRegionStart = piApp.Flag("region-start", "region start").Short('S').Default("0").Int()
	piRegionEnd   = piApp.Flag("region-end", "region end").Short('E').Default("0").Int()
开发者ID:mingzhi,项目名称:pileup,代码行数:31,代码来源:main.go


示例16: init

package main

import (
	"bufio"
	"fmt"
	"math/rand"

	"os"

	"github.com/alecthomas/kingpin"
	"github.com/couchbaselabs/logg"
	"github.com/tleyden/open-ocr-client"
)

var (
	app           = kingpin.New("open-ocr-client", "A command-line chat application.")
	stress        = app.Command("stress", "Do a stress test")
	upload        = app.Command("upload", "Upload a file to ocr")
	ocrUrl        = app.Flag("openOcrUrl", "URL where OpenOCR endpoint located").Default("http://api.openocr.net").String()
	ocrPort       = app.Flag("openOcrPort", "Port where OpenOCR endpoint located").Default("8080").Int()
	ocrFile       = upload.Flag("file", "File to ocr").Default("ocr_test.png").String()
	numIterations = stress.Arg("numIterations", "how many OCR jobs should each goroutine create?").Default("5").Int()
	numGoroutines = stress.Arg("numGoroutines", "how many goroutines should be launched?").Default("1").Int()

	numTestImages = 7
)

func init() {
	logg.LogKeys["CLI"] = true
	logg.LogKeys["OCRCLIENT"] = true
}
开发者ID:movermeyer,项目名称:open-ocr-client,代码行数:31,代码来源:main.go


示例17:

)

const (
	appName    = "gjoa"
	appVersion = "0.1"
	timeLayout = time.RFC3339
)

var (
	props      *Properties
	logDir     *string
	modelTypes = []string{"Gaussian", "GMM", "HMM"}
)

var (
	app         = kingpin.New(appName, "Gjøa statistical modeling command-line tool. (https://github.com/akualab/gjoa)")
	debug       = app.Flag("debug", "Enable debug mode.").Bool()
	logToStderr = app.Flag("log-stderr", "Logs are written to standard error instead of files.").Default("true").Bool()
	vLevel      = app.Flag("log-level", "Enable V-leveled logging at the specified level.").Default("0").Short('v').String()
	//	modelType   = app.Flag("model", "Model type.").Short('m').Enum(modelTypes...)
	inputModel = app.Flag("input-model", "An input model file.").Short('i').File()
	dataFile   = app.Flag("data", "Data file. See manual for format details.").File()
	dataDir    = app.Flag("dir", "Data dir. See manual for format details.").ExistingDir()
	dim        = app.Flag("dim", "Dimension of the feature vectors.").Int()
	modelName  = app.Flag("model-name", "Name of the model.").String()
	dictFile   = app.Flag("dict", "Dictionary file maps transcription names to model names.").File()

	config    = app.Command("config", "Updates fields in properties file.")
	configMap = config.Arg("properties", "Set properties.").StringMap()

	rand     = app.Command("rand", "Generate random data using model.")
开发者ID:henrylee2cn,项目名称:gjoa,代码行数:31,代码来源:gjoa.go


示例18: IsCumulative

}

// IsCumulative specifies S3List as a cumulative argument
func (s *s3List) IsCumulative() bool {
	return true
}

// S3List creates a new S3List kingpin setting
func S3List(s kingpin.Settings) (target *[]string) {
	target = new([]string)
	s.SetValue((*s3List)(target))
	return
}

var (
	app = kingpin.New("fasts3", "Multi-threaded s3 utility")

	ls            = app.Command("ls", "List s3 prefixes.")
	lsS3Uri       = ls.Arg("s3uri", "paritial s3 uri to list, ex: s3://mary/had/a/little/lamb/").Required().String()
	lsRecurse     = ls.Flag("recursive", "Get all keys for this prefix.").Short('r').Bool()
	lsSearchDepth = ls.Flag("search-depth", "search depth to search for work.").Default("0").Int()
	humanReadable = ls.Flag("human-readable", "human readable key size.").Short('H').Bool()
	withDate      = ls.Flag("with-date", "include the last modified date.").Short('d').Bool()

	del            = app.Command("del", "Delete s3 keys")
	delPrefixes    = S3List(del.Arg("prefixes", "1 or more partial s3 uris to delete delimited by space"))
	delRecurse     = del.Flag("recursive", "Delete all keys with prefix").Short('r').Bool()
	delSearchDepth = del.Flag("search-depth", "search depth to search for work.").Default("0").Int()

	get            = app.Command("get", "Fetch files from s3")
	getS3Uris      = S3List(get.Arg("prefixes", "list of prefixes or s3Uris to retrieve"))
开发者ID:hasGavriel,项目名称:fasts3,代码行数:31,代码来源:main.go


示例19: StartHost

package main

import (
	"fmt"
	"github.com/alecthomas/kingpin"
	"os"
	"runtime"
	"sync"
)

var (
	app          = kingpin.New("gosync", "A tool to sync a directory over a high-speed network.")
	mainPort     = app.Flag("port", "port number to listen or connect to when syncing").Short('p').Default("32011").Uint64()
	bufferSize   = app.Flag("buffer", "The size (in kB) of the buffer for sending/receiving.").Short('b').Default("131072").Int()
	hostCommand  = app.Command("host", "Make a directory available on the network.")
	hostPath     = hostCommand.Arg("path", "The directory to host.").Default(".").ExistingDir()
	hostHttp     = hostCommand.Flag("http", "Host the directory via http in addition to gosync.").Default("true").Bool()
	hostHttpAddr = hostCommand.Flag("http-addr", "The address to start the http server on").Default(":32080").String()
	recvCommand  = app.Command("recv", "Sync a directory from the network, locally.")
	recvPath     = recvCommand.Arg("path", "The directory to sync into.").Default(".").File()
	recvHost     = recvCommand.Flag("host", "Specify a direct address to connect to.").String()
)

func StartHost() {
	var wg sync.WaitGroup
	if *hostHttp {
		wg.Add(1)
		go func() {
			HostHTTP(*hostPath, *hostHttpAddr)
			wg.Done()
		}()
开发者ID:mastercactapus,项目名称:go-sync,代码行数:31,代码来源:main.go


示例20: main

func main() {
	app := kingpin.New("modular", "My modular application.")
	configureLsCommand(app)
	kingpin.MustParse(app.Parse(os.Args[1:]))
}
开发者ID:leonfs,项目名称:romulus,代码行数:5,代码来源:main.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang kingpin.Parse函数代码示例发布时间:2022-05-24
下一篇:
Golang kingpin.MustParse函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap