增加saastool功能
This commit is contained in:
33
cmd/saastool/main.go
Normal file
33
cmd/saastool/main.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := Run(os.Args[1:]...); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func Run(args ...string) error {
|
||||
|
||||
name, args := ParseCommandName(args)
|
||||
|
||||
// 从参数中解析出命令
|
||||
switch name {
|
||||
case "", "help":
|
||||
return RunHelp(args...)
|
||||
case "write":
|
||||
return RunWrite(args...)
|
||||
//case "read":
|
||||
// return RunRead(args...)
|
||||
default:
|
||||
err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'dmptool help' for usage`, name)
|
||||
slog.Warn(err.Error())
|
||||
return err
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user