本文整理汇总了Golang中github.com/alecthomas/kingpin.MustParse函数的典型用法代码示例。如果您正苦于以下问题:Golang MustParse函数的具体用法?Golang MustParse怎么用?Golang MustParse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MustParse函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Run
func (c Command) Run(args []string) {
var err error
cmd, err := c.Application.Parse(args[1:])
c.Client.DebugMode(*c.GlobalOptions.Debug)
switch kingpin.MustParse(cmd, err) {
case c.GenerateFile.FullCommand():
err = c.GenerateFileRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.CreatePost.FullCommand():
err = c.CreatePostRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.ShowPost.FullCommand():
err = c.ShowPostRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.ShowPosts.FullCommand():
err = c.ShowPostsRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.FetchPost.FullCommand():
err = c.FetchPostRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.FetchPosts.FullCommand():
err = c.FetchPostsRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.UpdatePost.FullCommand():
err = c.UpdatePostRunner.Run(c.Client, c.GlobalOptions, c.Out)
case c.DeletePost.FullCommand():
err = c.DeletePostRunner.Run(c.Client, c.GlobalOptions, c.Out)
}
if err != nil {
fmt.Fprintf(c.Error, "%s\n", err)
}
}
开发者ID:minodisk,项目名称:qiitactl,代码行数:29,代码来源:command.go
示例2: 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
示例3: 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
示例4: Main
func Main() error {
switch kingpin.MustParse(cli.Parse(os.Args[1:])) {
case server.FullCommand():
blob.StateDir = *serverStateDir
return ListenAndServe(*serverAddr)
default:
return errors.New("not implemented")
}
}
开发者ID:kiloe,项目名称:blobstore,代码行数:9,代码来源:main.go
示例5: main
func main() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case "flat2folder":
logg.LogTo("DATA_CONVERTER", "do flat2folder")
doFlat2folder(*sourceDir, *labelIndex, *destDir)
default:
kingpin.UsageErrorf("Invalid / missing command")
}
}
开发者ID:bryanyzhu,项目名称:elastic-thought,代码行数:9,代码来源:data_converter.go
示例6: dispatch
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
}
开发者ID:pmezard,项目名称:bnp,代码行数:10,代码来源:bnp.go
示例7: main
func main() {
kingpin.MustParse(app.Parse(os.Args[1:]))
server := NewServer()
if *logfile != "" {
server.SetLogfile(*logfile)
}
server.Start()
}
开发者ID:jeztek,项目名称:dvapbridge,代码行数:10,代码来源:main.go
示例8: main
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case "host":
StartHost()
case "recv":
StartRecv()
default:
kingpin.Usage()
}
}
开发者ID:mastercactapus,项目名称:go-sync,代码行数:12,代码来源:main.go
示例9: main
func main() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case "stress":
logg.LogTo("CLI", "do stress test")
stressTestLauncher()
case "upload":
logg.LogTo("CLI", "do upload")
uploadLauncher()
default:
logg.LogTo("CLI", "oops, nothing to do")
}
}
开发者ID:movermeyer,项目名称:open-ocr-client,代码行数:12,代码来源:main.go
示例10: main
func main() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
// Register user
case register.FullCommand():
println(*registerNick)
// Post message
case post.FullCommand():
if *postImage != nil {
}
text := strings.Join(*postText, " ")
println("Post:", text)
}
}
开发者ID:leonfs,项目名称:romulus,代码行数:14,代码来源:main.go
示例11: 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
示例12: main
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case "ls":
Ls(*lsS3Uri, *lsSearchDepth, *lsRecurse, *humanReadable, *withDate)
case "del":
Del(*delPrefixes, *lsSearchDepth, *delRecurse)
case "get":
Get(*getS3Uris, *getSearchDepth)
case "stream":
Stream(*streamS3Uris, *streamSearchDepth, *streamKeyRegex, *streamIncludeKeyName)
case "init":
Init()
}
}
开发者ID:hasGavriel,项目名称:fasts3,代码行数:15,代码来源:main.go
示例13: dispatch
func dispatch() error {
cmd := kingpin.MustParse(app.Parse(os.Args[1:]))
if *prof {
defer profile.Start(profile.CPUProfile).Stop()
}
cfg := NewConfig(*dataDir)
switch cmd {
case crawlCmd.FullCommand():
return crawlFn(cfg)
case indexCmd.FullCommand():
return indexOffers(cfg)
case searchCmd.FullCommand():
return search(cfg)
case webCmd.FullCommand():
return web(cfg)
case geocodeCmd.FullCommand():
return geocode(cfg)
case upgradeCmd.FullCommand():
return upgrade(cfg)
case dumpDeletedCmd.FullCommand():
return dumpDeletedOffersFn(cfg)
case changesCmd.FullCommand():
return changesFn(cfg)
case spatialCmd.FullCommand():
return spatialFn(cfg)
case debugQueryCmd.FullCommand():
return debugQueryFn(cfg)
case analyzeCmd.FullCommand():
return analyzeFn(cfg)
case geocodedCmd.FullCommand():
return geocodedFn(cfg)
case densityCmd.FullCommand():
return densityFn(cfg)
case histogramCmd.FullCommand():
return histogramFn(cfg)
case indexStatsCmd.FullCommand():
return indexStatsFn(cfg)
case listDeletedCmd.FullCommand():
return listDeletedFn(cfg)
case duplicatesCmd.FullCommand():
return duplicatesFn(cfg)
case dumpOfferCmd.FullCommand():
return dumpOfferFn(cfg)
}
return fmt.Errorf("unknown command: %s", cmd)
}
开发者ID:pmezard,项目名称:apec,代码行数:46,代码来源:apec.go
示例14: main
func main() {
log15.Info("Welcome to Listless!", log15.Ctx{"context": "setup"})
cmd := kingpin.MustParse(app.Parse(os.Args[1:]))
switch cmd {
case loopMode.FullCommand():
loopModeF()
case execMode.FullCommand():
execModeF()
case subUpdateAction.FullCommand():
subUpdateModeF()
case subRemoveAction.FullCommand():
subRemoveModeF()
case subListMode.FullCommand():
subListModeF()
default:
log.Fatal("No valid command given. Try '--help' for ideas.")
}
}
开发者ID:cathalgarvey,项目名称:listless,代码行数:18,代码来源:main.go
示例15: main
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
app.Version(appVersion)
cmd := kingpin.MustParse(app.Parse(os.Args[1:]))
initGlog()
defer glog.Flush()
printAppValues()
checkDir(props.Workspace)
switch cmd {
case config.FullCommand():
glog.V(3).Info("start config command")
case rand.FullCommand():
glog.V(3).Info("start rand command")
case "train gaussian":
var m model.Trainer
*numIter = 1
m = gaussian.NewModel(*dim, gaussian.Name(*modelName))
doTrain(m)
case "train gmm":
var m model.Trainer
m = gmm.NewModel(*dim, *numGMM, gmm.Name(*modelName))
doTrain(m)
case "train hmm":
var m model.Trainer
m = hmm.NewModel(hmmOptions()...)
doTrain(m)
default:
app.Usage(os.Stderr)
}
}
开发者ID:henrylee2cn,项目名称:gjoa,代码行数:36,代码来源:gjoa.go
示例16: runCli
func runCli() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case liftCommand.FullCommand():
commandAction(*liftTargetArg, func(uow *UnitOfWork) {
uow.Lift(*liftCmdArg, *liftNoCacheFlag, *liftParallelFlag)
}, true)
case versionCommand.FullCommand():
fmt.Println("v2.10.2")
case statsCommand.FullCommand():
commandAction(*statsTargetArg, func(uow *UnitOfWork) {
uow.Stats(*statsNoStreamFlag)
}, false)
case statusCommand.FullCommand():
commandAction(*statusTargetArg, func(uow *UnitOfWork) {
uow.Status(*noTruncFlag)
}, false)
case pushCommand.FullCommand():
commandAction(*pushTargetArg, func(uow *UnitOfWork) {
uow.Push()
}, false)
case unpauseCommand.FullCommand():
commandAction(*unpauseTargetArg, func(uow *UnitOfWork) {
uow.Unpause()
}, false)
case pauseCommand.FullCommand():
commandAction(*pauseTargetArg, func(uow *UnitOfWork) {
uow.Pause()
}, false)
case startCommand.FullCommand():
commandAction(*startTargetArg, func(uow *UnitOfWork) {
uow.Start()
}, true)
case stopCommand.FullCommand():
commandAction(*stopTargetArg, func(uow *UnitOfWork) {
uow.Stop()
}, false)
case killCommand.FullCommand():
commandAction(*killTargetArg, func(uow *UnitOfWork) {
uow.Kill()
}, false)
case execCommand.FullCommand():
commandAction(*execTargetArg, func(uow *UnitOfWork) {
uow.Exec(*execCmdArg)
}, false)
case rmCommand.FullCommand():
commandAction(*rmTargetArg, func(uow *UnitOfWork) {
uow.Rm(*forceRmFlag)
}, false)
case runCommand.FullCommand():
commandAction(*runTargetArg, func(uow *UnitOfWork) {
uow.Run(*runCmdArg)
}, true)
case createCommand.FullCommand():
commandAction(*createTargetArg, func(uow *UnitOfWork) {
uow.Create(*createCmdArg)
}, true)
case provisionCommand.FullCommand():
commandAction(*provisionTargetArg, func(uow *UnitOfWork) {
uow.Provision(*provisionNoCacheFlag, *provisionParallelFlag)
}, false)
case pullCommand.FullCommand():
commandAction(*pullTargetArg, func(uow *UnitOfWork) {
uow.PullImage()
}, false)
case logsCommand.FullCommand():
commandAction(*logsTargetArg, func(uow *UnitOfWork) {
uow.Logs(*followFlag, *timestampsFlag, *tailFlag, *colorizeFlag, *sinceFlag)
}, false)
case generateCommand.FullCommand():
if len(*templateFlag) == 0 {
printErrorf("ERROR: No template specified. The flag `--template` is required.\n")
return
}
commandAction(*generateTargetArg, func(uow *UnitOfWork) {
uow.Generate(*templateFlag, *outputFlag)
}, false)
case syncStartCommand.FullCommand():
cfg = NewConfig(*configFlag, *prefixFlag, *tagFlag)
sync := cfg.MacSync(*syncStartVolumeArg)
if sync == nil {
printErrorf("ERROR: No such sync configured: %s.", *syncStartVolumeArg)
//.........这里部分代码省略.........
开发者ID:jesper,项目名称:crane,代码行数:101,代码来源:cli.go
示例17: handleCmd
func handleCmd() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case liftCommand.FullCommand():
commandAction(*liftTargetArg, func(uow *UnitOfWork) {
uow.Lift(*liftCmdArg, excluded, *liftNoCacheFlag)
}, true)
case versionCommand.FullCommand():
fmt.Println("v2.1.0")
case graphCommand.FullCommand():
commandAction(*graphTargetArg, func(uow *UnitOfWork) {
cfg.DependencyGraph(excluded).DOT(os.Stdout, uow.Targeted().Reversed())
}, false)
case statsCommand.FullCommand():
commandAction(*statsTargetArg, func(uow *UnitOfWork) {
uow.Stats()
}, false)
case statusCommand.FullCommand():
commandAction(*statusTargetArg, func(uow *UnitOfWork) {
uow.Status(*noTruncFlag)
}, false)
case pushCommand.FullCommand():
commandAction(*pushTargetArg, func(uow *UnitOfWork) {
uow.Push()
}, false)
case unpauseCommand.FullCommand():
commandAction(*unpauseTargetArg, func(uow *UnitOfWork) {
uow.Unpause()
}, false)
case pauseCommand.FullCommand():
commandAction(*pauseTargetArg, func(uow *UnitOfWork) {
uow.Pause()
}, false)
case startCommand.FullCommand():
commandAction(*startTargetArg, func(uow *UnitOfWork) {
uow.Start()
}, true)
case stopCommand.FullCommand():
commandAction(*stopTargetArg, func(uow *UnitOfWork) {
uow.Stop()
}, false)
case killCommand.FullCommand():
commandAction(*killTargetArg, func(uow *UnitOfWork) {
uow.Kill()
}, false)
case execCommand.FullCommand():
commandAction(*execTargetArg, func(uow *UnitOfWork) {
uow.Exec(*execCmdArg)
}, false)
case rmCommand.FullCommand():
commandAction(*rmTargetArg, func(uow *UnitOfWork) {
uow.Rm(*forceRmFlag)
}, false)
case runCommand.FullCommand():
commandAction(*runTargetArg, func(uow *UnitOfWork) {
uow.Run(*runCmdArg, excluded)
}, true)
case createCommand.FullCommand():
commandAction(*createTargetArg, func(uow *UnitOfWork) {
uow.Create(*createCmdArg, excluded)
}, true)
case provisionCommand.FullCommand():
commandAction(*provisionTargetArg, func(uow *UnitOfWork) {
uow.Provision(*provisionNoCacheFlag)
}, false)
case pullCommand.FullCommand():
commandAction(*pullTargetArg, func(uow *UnitOfWork) {
uow.PullImage()
}, false)
case logsCommand.FullCommand():
commandAction(*logsTargetArg, func(uow *UnitOfWork) {
uow.Logs(*followFlag, *timestampsFlag, *tailFlag, *colorizeFlag, *sinceFlag)
}, false)
}
}
开发者ID:rajkumar1979,项目名称:crane,代码行数:92,代码来源:cmd.go
示例18: main
func main() {
command := kingpin.MustParse(app.Parse(os.Args[1:]))
runtime.GOMAXPROCS(*ncpu)
switch command {
case filterApp.FullCommand():
filtercmd := cmdFilter{
featureDB: *filterFeatureDB,
bamFile: *filterBam,
outFile: *filterOut,
maxDistance: *filterMaxDist,
mapQ: *filterMapQ,
}
filtercmd.run()
case featApp.FullCommand():
featcmd := cmdFeat{
out: *featOut,
dir: *featDir,
}
featcmd.run()
break
case readApp.FullCommand():
readcmd := cmdRead{
pileupFile: *pileupFile,
dbfile: *readOut,
minCover: *readMinCover,
minDepth: *readMinDepth,
featureDB: *readFeature,
}
readcmd.run()
break
case reportApp.FullCommand():
var sizeDB int64 = 1 << 30
numDB := 10
featureDB, err := createNoLockEnv(*reportFeatureDB, numDB, sizeDB)
for lmdb.IsMapFull(err) {
sizeDB *= 2
featureDB, err = createNoLockEnv(*reportFeatureDB, numDB, sizeDB)
}
raiseError(err)
defer featureDB.Close()
sizeDB = 1 << 30
resultsDB, err := createNoLockEnv(*reportResultsDB, numDB, sizeDB)
for lmdb.IsMapFull(err) {
sizeDB *= 2
resultsDB, err = createNoLockEnv(*reportResultsDB, numDB, sizeDB)
}
raiseError(err)
defer resultsDB.Close()
reportcmd := cmdReport{
featureDB: featureDB,
resultsDB: resultsDB,
prefix: *reportPrefix,
maxl: *reportMaxl,
}
reportcmd.run()
break
// case report2App.FullCommand():
// featureDB := createNoLockEnv(*report2FeatureDB, 10, 0)
// defer featureDB.Close()
// resultsDB := createReadOnlyEnv(*report2ResultsDB, 10, 0)
// defer resultsDB.Close()
// reportcmd2 := cmdReport2{
// featureDB: featureDB,
// resultsDB: resultsDB,
// prefix: *report2Prefix,
// }
// reportcmd2.run()
// break
case covApp.FullCommand():
crcmd := cmdCr{
dbfile: *covResultsDb,
codonID: *covGC,
featureDbPath: *covFeatureDb,
minDepth: *covMinDepth,
}
crcmd.run()
break
case mergeApp.FullCommand():
mergecmd := cmdMerge{
sampleFile: *mergeSampleFile,
dbiName: *mergeDbiName,
dbOut: *mergeOutDb,
}
mergecmd.run()
break
}
}
开发者ID:mingzhi,项目名称:pileup,代码行数:89,代码来源:main.go
示例19: runCli
func runCli() {
switch kingpin.MustParse(app.Parse(os.Args[1:])) {
case liftCommand.FullCommand():
commandAction(*liftTargetArg, func(uow *UnitOfWork) {
uow.Lift(*liftCmdArg, *liftNoCacheFlag, *liftParallelFlag)
}, true)
case versionCommand.FullCommand():
fmt.Println("v2.8.0")
case statsCommand.FullCommand():
commandAction(*statsTargetArg, func(uow *UnitOfWork) {
uow.Stats()
}, false)
case statusCommand.FullCommand():
commandAction(*statusTargetArg, func(uow *UnitOfWork) {
uow.Status(*noTruncFlag)
}, false)
case pushCommand.FullCommand():
commandAction(*pushTargetArg, func(uow *UnitOfWork) {
uow.Push()
}, false)
case unpauseCommand.FullCommand():
commandAction(*unpauseTargetArg, func(uow *UnitOfWork) {
uow.Unpause()
}, false)
case pauseCommand.FullCommand():
commandAction(*pauseTargetArg, func(uow *UnitOfWork) {
uow.Pause()
}, false)
case startCommand.FullCommand():
commandAction(*startTargetArg, func(uow *UnitOfWork) {
uow.Start()
}, true)
case stopCommand.FullCommand():
commandAction(*stopTargetArg, func(uow *UnitOfWork) {
uow.Stop()
}, false)
case killCommand.FullCommand():
commandAction(*killTargetArg, func(uow *UnitOfWork) {
uow.Kill()
}, false)
case execCommand.FullCommand():
commandAction(*execTargetArg, func(uow *UnitOfWork) {
uow.Exec(*execCmdArg)
}, false)
case rmCommand.FullCommand():
commandAction(*rmTargetArg, func(uow *UnitOfWork) {
uow.Rm(*forceRmFlag)
}, false)
case runCommand.FullCommand():
commandAction(*runTargetArg, func(uow *UnitOfWork) {
uow.Run(*runCmdArg)
}, true)
case createCommand.FullCommand():
commandAction(*createTargetArg, func(uow *UnitOfWork) {
uow.Create(*createCmdArg)
}, true)
case provisionCommand.FullCommand():
commandAction(*provisionTargetArg, func(uow *UnitOfWork) {
uow.Provision(*provisionNoCacheFlag, *provisionParallelFlag)
}, false)
case pullCommand.FullCommand():
commandAction(*pullTargetArg, func(uow *UnitOfWork) {
uow.PullImage()
}, false)
case logsCommand.FullCommand():
commandAction(*logsTargetArg, func(uow *UnitOfWork) {
uow.Logs(*followFlag, *timestampsFlag, *tailFlag, *colorizeFlag, *sinceFlag)
}, false)
case generateCommand.FullCommand():
if len(*templateFlag) == 0 {
printErrorf("ERROR: No template specified. The flag `--template` is required.\n")
return
}
commandAction(*generateTargetArg, func(uow *UnitOfWork) {
uow.Generate(*templateFlag, *outputFlag)
}, false)
}
}
开发者ID:bivas,项目名称:crane,代码行数:96,代码来源:cli.go
示例20: main
func main() {
app.Writer(os.Stdout)
app.Version(VV)
app.HelpFlag.Short('h')
app.VersionFlag.Short('v')
command := kingpin.MustParse(app.Parse(os.Args[1:]))
err := ReadConfig(*configFile, *account)
if !strings.HasPrefix(command, "config") && !strings.HasPrefix(command, "update") {
// Makes sure the config file structure is valid
if err != nil {
fatalError("%s: Error reading config file: %s\n", filepath.Base(os.Args[0]), err.Error())
}
// Make sure the config file auth token is valid. Check now so we don't have to
// keep rechecking in code.
_, err := Config.Account.Client15()
if err != nil {
fatalError("Authentication error: %s", err.Error())
}
}
// Handle logging
logLevel := log15.LvlInfo
if *debug {
log.Logger.SetHandler(
log15.LvlFilterHandler(
log15.LvlDebug,
log15.StderrHandler))
httpclient.DumpFormat = httpclient.Debug
logLevel = log15.LvlDebug
}
handler := log15.LvlFilterHandler(logLevel, log15.StreamHandler(colorable.NewColorableStdout(), log15.TerminalFormat()))
log15.Root().SetHandler(handler)
if Config.GetBool("update.check") && !strings.HasPrefix(command, "update") {
defer UpdateCheck(VV, os.Stderr)
}
switch command {
case stShowCmd.FullCommand():
href, err := paramToHref("server_templates", *stShowNameOrHref, 0)
if err != nil {
fatalError("%s", err.Error())
}
stShow(href)
case stUploadCmd.FullCommand():
files, err := walkPaths(*stUploadPaths)
if err != nil {
fatalError("%s\n", err.Error())
}
stUpload(files, *stUploadPrefix)
case stDeleteCmd.FullCommand():
files, err := walkPaths(*stDeletePaths)
if err != nil {
fatalError("%s\n", err.Error())
}
stDelete(files, *stDeletePrefix)
case stDownloadCmd.FullCommand():
href, err := paramToHref("server_templates", *stDownloadNameOrHref, 0)
if err != nil {
fatalError("%s", err.Error())
}
stDownload(href, *stDownloadTo, *stDownloadPublished, *stDownloadMciSettings, *stDownloadScriptPath)
case stValidateCmd.FullCommand():
files, err := walkPaths(*stValidatePaths)
if err != nil {
fatalError("%s\n", err.Error())
}
stValidate(files)
case rightScriptShowCmd.FullCommand():
href, err := paramToHref("right_scripts", *rightScriptShowNameOrHref, 0)
if err != nil {
fatalError("%s", err.Error())
}
rightScriptShow(href)
case rightScriptUploadCmd.FullCommand():
files, err := walkPaths(*rightScriptUploadPaths)
if err != nil {
fatalError("%s\n", err.Error())
}
rightScriptUpload(files, *rightScriptUploadForce, *rightScriptUploadPrefix)
case rightScriptDeleteCmd.FullCommand():
files, err := walkPaths(*rightScriptDeletePaths)
if err != nil {
fatalError("%s\n", err.Error())
}
rightScriptDelete(files, *rightScriptDeletePrefix)
case rightScriptDownloadCmd.FullCommand():
href, err := paramToHref("right_scripts", *rightScriptDownloadNameOrHref, 0)
if err != nil {
fatalError("%s", err.Error())
}
rightScriptDownload(href, *rightScriptDownloadTo)
case rightScriptScaffoldCmd.FullCommand():
files, err := walkPaths(*rightScriptScaffoldPaths)
if err != nil {
fatalError("%s\n", err.Error())
}
//.........这里部分代码省略.........
开发者ID:rightscale,项目名称:right_st,代码行数:101,代码来源:main.go
注:本文中的github.com/alecthomas/kingpin.MustParse函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论