Skip to content

Commit

Permalink
pull out ExitStatus interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cppforlife committed Mar 18, 2020
1 parent 1a560ed commit 9a857ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/kapp/kapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
err := command.Execute()
if err != nil {
confUI.ErrorLinef("kapp: Error: %v", err)
if typedErr, ok := err.(cmdapp.DeployDiffExitStatus); ok {
if typedErr, ok := err.(cmdapp.ExitStatus); ok {
os.Exit(typedErr.ExitStatus())
}
os.Exit(1)
Expand Down
6 changes: 6 additions & 0 deletions pkg/kapp/cmd/app/deploy_diff_exit_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ import (
"fmt"
)

type ExitStatus interface {
ExitStatus() int
}

type DeployDiffExitStatus struct {
hasNoChanges bool
}

var _ ExitStatus = DeployDiffExitStatus{}

func (d DeployDiffExitStatus) Error() string {
numStr := "pending changes"
if d.hasNoChanges {
Expand Down

0 comments on commit 9a857ec

Please sign in to comment.