Exit with error code from subcommands as well as root command
This commit is contained in:
parent
7de7cf38f9
commit
09bc5dd8e5
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
@ -92,6 +93,7 @@ func CommandWrapper(command func(*cobra.Command, []string) error) func(*cobra.Co
|
|||
err := command(cmd, args)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue