Browse Source

propogated build errors to top level. Fixes bug issue #11 'build doesn't return correct status code'

pull/22/head
David Haukeness 5 years ago
parent
commit
8f2b2110e0
No known key found for this signature in database
GPG Key ID: A7F1091956853EF9
  1. 44
      mage.go

44
mage.go

@ -82,16 +82,32 @@ func BuildEmoji() error { @@ -82,16 +82,32 @@ func BuildEmoji() error {
return nil
}
// proper error reporting and exit code
func exit(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "%+v\n", err)
os.Exit(1)
}
}
// Build kbtui with just the basic commands.
func Build() {
sh.Run("go", "build")
if err := sh.Run("go", "build"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with the basic commands, and the ShowReactions "TypeCommand".
// The ShowReactions TypeCommand will print a message in the feed window when
// a reaction is received in the current conversation.
func BuildShowReactions() {
sh.Run("go", "build", "-tags", "showreactionscmd")
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with the basec commands, and the AutoReact "TypeCommand".
@ -99,21 +115,37 @@ func BuildShowReactions() { @@ -99,21 +115,37 @@ func BuildShowReactions() {
// received in the current conversation. This gets pretty annoying, and
// is not recommended.
func BuildAutoReact() {
sh.Run("go", "build", "-tags", "autoreactcmd")
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with all commands and TypeCommands disabled.
func BuildAllCommands() {
sh.Run("go", "build", "-tags", "allcommands")
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with all Commands and TypeCommands enabled.
func BuildAllCommandsT() {
sh.Run("go", "build", "-tags", "type_commands,allcommands")
if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with beta functionality
func BuildBeta() {
mg.Deps(BuildEmoji)
sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList")
if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil {
defer func() {
exit(err)
}()
}
}

Loading…
Cancel
Save