43 lines
875 B
Go
43 lines
875 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"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:
|
|
return fmt.Errorf(`Unknown command "%s"`+"\n"+`Run 'saastool bind help' for usage`, name)
|
|
}
|
|
}
|
|
|
|
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.
|
|
`
|