Skip to content

Commit

Permalink
commands: non-zero exit status on error
Browse files Browse the repository at this point in the history
fixes #133
  • Loading branch information
boz committed Mar 26, 2018
1 parent 236119c commit 219734b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cmd/akash/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (

func baseCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "akash",
Short: "Akash client",
Use: "akash",
Short: "Akash client",
SilenceUsage: true,
}
context.SetupBaseCommand(cmd)
return cmd
Expand Down
6 changes: 5 additions & 1 deletion cmd/akash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"math/rand"
"os"
"time"

"github.com/ovrclk/akash/cmd/akash/query"
Expand All @@ -17,5 +18,8 @@ func main() {
root.AddCommand(query.QueryCommand())
root.AddCommand(statusCommand())
root.AddCommand(marketplaceCommand())
root.Execute()

if err := root.Execute(); err != nil {
os.Exit(1)
}
}
5 changes: 3 additions & 2 deletions cmd/akashd/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ func initEnv(path string) error {

func baseCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "akashd",
Short: "Akash node",
Use: "akashd",
Short: "Akash node",
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
root, err := cmd.Flags().GetString(flagRootDir)
if err != nil {
Expand Down
7 changes: 6 additions & 1 deletion cmd/akashd/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package main

import "os"

func main() {
root := baseCommand()
root.AddCommand(initCommand())
root.AddCommand(startCommand())
root.Execute()

if err := root.Execute(); err != nil {
os.Exit(1)
}
}

0 comments on commit 219734b

Please sign in to comment.