Skip to content

Commit

Permalink
Fix failed commands exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
chapsuk committed Feb 9, 2023
1 parent 2049090 commit 10dc3d5
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func Create(driver func() driver.Interface) *cobra.Command {
}

if err := driver().Create(name, ext); err != nil {
logger.G().Errorf("create: %s", err)
logger.G().Fatalf("create: %s", err)
}
},
}
Expand Down
4 changes: 2 additions & 2 deletions commands/down.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Down(driver func() driver.Interface) *cobra.Command {
Short: "down last migration",
Run: func(cmd *cobra.Command, args []string) {
if err := driver().Down(); err != nil {
logger.G().Errorf("down: %s", err)
logger.G().Fatalf("down: %s", err)
}
},
}
Expand All @@ -31,7 +31,7 @@ func DownTo(driver func() driver.Interface) *cobra.Command {
}
version := args[0]
if err := driver().DownTo(version); err != nil {
logger.G().Errorf("down: %s", err)
logger.G().Fatalf("down: %s", err)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion commands/redo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Redo(driver func() driver.Interface) *cobra.Command {
Short: "redo cmd",
Run: func(cmd *cobra.Command, args []string) {
if err := driver().Redo(); err != nil {
logger.G().Errorf("redo: %s", err)
logger.G().Fatalf("redo: %s", err)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion commands/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func Reset(driver func() driver.Interface) *cobra.Command {
logger.G().Info("ok")

if err := driver().Reset(); err != nil {
logger.G().Errorf("reset: %s", err)
logger.G().Fatalf("reset: %s", err)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion commands/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Status(driver func() driver.Interface) *cobra.Command {
Short: "returns current db status",
Run: func(cmd *cobra.Command, args []string) {
if err := driver().Status(); err != nil {
logger.G().Errorf("status: %s", err)
logger.G().Fatalf("status: %s", err)
}
},
}
Expand Down
4 changes: 2 additions & 2 deletions commands/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Up(driver func() driver.Interface) *cobra.Command {
Short: "up db to latest version",
Run: func(cmd *cobra.Command, args []string) {
if err := driver().Up(); err != nil {
logger.G().Errorf("get version: %s", err)
logger.G().Fatalf("get version: %s", err)
}
},
}
Expand All @@ -31,7 +31,7 @@ func UpTo(driver func() driver.Interface) *cobra.Command {
}
version := args[0]
if err := driver().UpTo(version); err != nil {
logger.G().Errorf("get version: %s", err)
logger.G().Fatalf("get version: %s", err)
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Version(driver func() driver.Interface) *cobra.Command {
Short: "get current db version",
Run: func(cmd *cobra.Command, args []string) {
if err := driver().Version(); err != nil {
logger.G().Errorf("get version: %s", err)
logger.G().Fatalf("get version: %s", err)
}
},
}
Expand Down

0 comments on commit 10dc3d5

Please sign in to comment.