Minor change

pull/18/head
Simon Let 6 years ago
parent 82a40f7f29
commit d4959cffbe
  1. 7
      cmd/control/cmd/root.go
  2. 4
      cmd/control/status/status.go

@ -2,13 +2,12 @@ package cmd
import ( import (
"fmt" "fmt"
"log"
"github.com/curusarn/resh/cmd/control/status" "github.com/curusarn/resh/cmd/control/status"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var exitCode status.Code = status.DefaultInvalid var exitCode status.Code
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
Use: "reshctl", Use: "reshctl",
@ -31,9 +30,5 @@ func Execute() status.Code {
fmt.Println(err) fmt.Println(err)
return status.Fail return status.Fail
} }
if exitCode == status.DefaultInvalid {
log.Println("reshctl FATAL ERROR: (sub)command didn't set exitCode!")
return status.Fail
}
return exitCode return exitCode
} }

@ -4,10 +4,8 @@ package status
type Code int type Code int
const ( const (
// DefaultInvalid exit code
DefaultInvalid Code = -1
// Success exit code // Success exit code
Success = 0 Success Code = 0
// Fail exit code // Fail exit code
Fail = 1 Fail = 1
// EnableAll exit code - tells reshctl() wrapper to enable_all // EnableAll exit code - tells reshctl() wrapper to enable_all

Loading…
Cancel
Save