Skip to content

Commit

Permalink
cmk: don't print discovered apis message in cmd line mode
Browse files Browse the repository at this point in the history
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 <rohit.yadav@shapeblue.com>
  • Loading branch information
rohityadavcloud committed Aug 3, 2023
1 parent 23852c7 commit e3e577c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmk.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func main() {
apiKey := flag.String("k", "", "cloudStack user's API Key")
secretKey := flag.String("s", "", "cloudStack user's secret Key")
flag.Parse()
args := flag.Args()

cfg := config.NewConfig(configFilePath)

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

cli.SetConfig(cfg)

args := flag.Args()
config.Debug("cmdline args:", strings.Join(os.Args, ", "))
if len(args) > 0 {
if err := cli.ExecCmd(args); err != nil {
Expand Down

0 comments on commit e3e577c

Please sign in to comment.