Skip to content

Commit

Permalink
Do not print Succeeded for help command
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenrewar committed Aug 25, 2022
1 parent bc768e4 commit 971a987
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion cmd/kapp/kapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ package main
import (
"math/rand"
"os"
"strings"
"time"

uierrs "github.com/cppforlife/go-cli-ui/errors"
"github.com/cppforlife/go-cli-ui/ui"
"github.com/spf13/cobra"
"github.com/vmware-tanzu/carvel-kapp/pkg/kapp/cmd"
cmdapp "github.com/vmware-tanzu/carvel-kapp/pkg/kapp/cmd/app"

Expand Down Expand Up @@ -45,6 +47,22 @@ func nonExitingMain() error {
return err
}

confUI.PrintLinef("Succeeded")
if len(os.Args) > 1 {
cmdPathPieces := os.Args[1:]

var cmdName string // first "non-flag" arguments
for _, arg := range cmdPathPieces {
if !strings.HasPrefix(arg, "-") {
cmdName = arg
break
}
}
switch cmdName {
case "help", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd:
// do not print Succeeded
default:
confUI.PrintLinef("Succeeded")
}
}
return nil
}

0 comments on commit 971a987

Please sign in to comment.