saastool增加docker/daemon模式
This commit is contained in:
43
cmd/saastool/exp.go
Normal file
43
cmd/saastool/exp.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func RunExp(args ...string) error {
|
||||
name, args := ParseCommandName(args)
|
||||
|
||||
// 从参数中解析出命令
|
||||
switch name {
|
||||
case "", "help":
|
||||
return RunExpHelp(args...)
|
||||
case "list":
|
||||
return RunExpList(args...)
|
||||
case "get":
|
||||
return RunExpGet(args...)
|
||||
default:
|
||||
err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'saastool exp help' for usage`, name)
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func RunExpHelp(args ...string) error {
|
||||
fmt.Println(strings.TrimSpace(expUsage))
|
||||
return nil
|
||||
}
|
||||
|
||||
const expUsage = `
|
||||
Usage: saastoola exp COMMAND [OPTIONS]
|
||||
|
||||
Commands:
|
||||
list List exps
|
||||
get Get exp report
|
||||
|
||||
"help" is the default command.
|
||||
|
||||
Use "saastool exp COMMAND -help" for more information about a command.
|
||||
`
|
||||
Reference in New Issue
Block a user