增加策略列表、绑定、解绑
This commit is contained in:
46
cmd/saastool/bind.go
Normal file
46
cmd/saastool/bind.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func RunBind(args ...string) error {
|
||||
name, args := ParseCommandName(args)
|
||||
|
||||
// 从参数中解析出命令
|
||||
switch name {
|
||||
case "", "help":
|
||||
return RunBindHelp(args...)
|
||||
case "setaccount":
|
||||
return RunBindSetAccount(args...)
|
||||
case "setad":
|
||||
return RunBindSetAd(args...)
|
||||
case "delete":
|
||||
return RunBindDelete(args...)
|
||||
default:
|
||||
err := fmt.Errorf(`unknown command "%s"`+"\n"+`Run 'saastool bind help' for usage`, name)
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func RunBindHelp(args ...string) error {
|
||||
fmt.Println(strings.TrimSpace(bindUsage))
|
||||
return nil
|
||||
}
|
||||
|
||||
const bindUsage = `
|
||||
Usage: saastoola bind COMMAND [OPTIONS]
|
||||
|
||||
Commands:
|
||||
setaccount Set Account binds
|
||||
setad Set AdGroup binds
|
||||
delete Delete binds
|
||||
|
||||
"help" is the default command.
|
||||
|
||||
Use "saastool bind COMMAND -help" for more information about a command.
|
||||
`
|
||||
Reference in New Issue
Block a user