Skip to content

Commit

Permalink
pd-ctl: fix output (#1772)
Browse files Browse the repository at this point in the history
Signed-off-by: lhy1024 <[email protected]>
  • Loading branch information
lhy1024 authored and disksing committed Sep 26, 2019
1 parent 6e44953 commit aa9e005
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tools/pd-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ var (
url string
detach bool
version bool
help bool
caPath string
certPath string
keyPath string
)

func init() {
flag.StringVarP(&url, "pd", "u", "http://127.0.0.1:2379", "The pd address")
flag.BoolVarP(&detach, "detach", "d", false, "Run pdctl without readline")
flag.BoolVarP(&version, "version", "V", false, "print version information and exit")
flag.StringVar(&caPath, "cacert", "", "path of file that contains list of trusted SSL CAs.")
flag.StringVar(&certPath, "cert", "", "path of file that contains X509 certificate in PEM format.")
flag.StringVar(&keyPath, "key", "", "path of file that contains X509 key in PEM format.")
flag.StringVarP(&url, "pd", "u", "http://127.0.0.1:2379", "The pd address.")
flag.BoolVarP(&detach, "detach", "d", false, "Run pdctl without readline.")
flag.BoolVarP(&version, "version", "V", false, "Print version information and exit.")
flag.StringVar(&caPath, "cacert", "", "The path of file that contains list of trusted SSL CAs.")
flag.StringVar(&certPath, "cert", "", "The path of file that contains X509 certificate in PEM format.")
flag.StringVar(&keyPath, "key", "", "The path of file that contains X509 key in PEM format.")
flag.BoolVarP(&help, "help", "h", false, "Help message.")
}

func main() {
Expand All @@ -55,6 +57,10 @@ func main() {
flag.CommandLine.ParseErrorsWhitelist.UnknownFlags = true
flag.Parse()

if help {
flag.Usage()
os.Exit(0)
}
if version {
server.PrintPDInfo()
os.Exit(0)
Expand Down
1 change: 1 addition & 0 deletions tools/pd-ctl/pdctl/command/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ func removeOperatorCommandFunc(cmd *cobra.Command, args []string) {
fmt.Println(err)
return
}
cmd.Println("Success!")
}

func parseUint64s(args []string) ([]uint64, error) {
Expand Down
1 change: 1 addition & 0 deletions tools/pd-ctl/pdctl/command/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,5 @@ func removeSchedulerCommandFunc(cmd *cobra.Command, args []string) {
fmt.Println(err)
return
}
cmd.Println("Success!")
}

0 comments on commit aa9e005

Please sign in to comment.