Skip to content

Commit e3e577c

Browse files
cmk: don't print discovered apis message in cmd line mode
This avoids printing message in cmd line mode, where output of the cmk command may be processed by a shell script. Signed-off-by: Rohit Yadav <[email protected]>
1 parent 23852c7 commit e3e577c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmk.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func main() {
5151
apiKey := flag.String("k", "", "cloudStack user's API Key")
5252
secretKey := flag.String("s", "", "cloudStack user's secret Key")
5353
flag.Parse()
54+
args := flag.Args()
5455

5556
cfg := config.NewConfig(configFilePath)
5657

@@ -91,14 +92,13 @@ func main() {
9192
if *apiKey != "" && *secretKey != "" {
9293
request := cmd.NewRequest(nil, cfg, nil)
9394
syncResponse, err := cmd.NewAPIRequest(request, "listApis", []string{"listall=true"}, false)
94-
if err == nil {
95+
if err == nil && len(args) == 0 {
9596
fmt.Printf("Discovered %v APIs\n", cfg.UpdateCache(syncResponse))
9697
}
9798
}
9899

99100
cli.SetConfig(cfg)
100101

101-
args := flag.Args()
102102
config.Debug("cmdline args:", strings.Join(os.Args, ", "))
103103
if len(args) > 0 {
104104
if err := cli.ExecCmd(args); err != nil {

0 commit comments

Comments
 (0)