Skip to content

Commit

Permalink
fix error handling
Browse files Browse the repository at this point in the history
since bumbping cobra version the upstream bug is now resolved
spf13/cobra#894
  • Loading branch information
itaysk authored and erikgb committed Jun 19, 2022
1 parent 345440b commit 0ed5546
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func init() {
// Execute is the entry point for the command package
func Execute() {
if err := rootCmd.Execute(); err != nil {
rootCmd.PrintErr(err) // can't use PrintErrln or PrintErrf due to a bug https://github.com/spf13/cobra/pull/894
os.Exit(1)
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e-cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ rootDir="./test/fixtures"
echo $exe >&3
run2 "$exe" --foo
[ $status -eq 1 ]
[[ "$stderr" == "unknown flag: --foo" ]]
[[ "$stderr" == "Error: unknown flag: --foo"* ]]
}

@test "invalid args 2" {
run2 "$exe" get --foo
[ $status -eq 1 ]
[[ "$stderr" == "Error invoking kubectl"* ]]
[[ "$stderr" == "Error: Error invoking kubectl"* ]]
}

@test "invalid args 3" {
run2 "$exe" foo
[ $status -eq 1 ]
[[ "$stderr" == 'unknown command "foo" for "kubectl-neat"' ]]
[[ "$stderr" == 'Error: unknown command "foo" for "kubectl-neat"'* ]]
}

@test "local file" {
Expand Down

0 comments on commit 0ed5546

Please sign in to comment.