|
|
@ -5,12 +5,13 @@ package main |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"github.com/magefile/mage/mg" |
|
|
|
|
|
|
|
"github.com/magefile/mage/sh" |
|
|
|
|
|
|
|
"io/ioutil" |
|
|
|
"io/ioutil" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/magefile/mage/mg" |
|
|
|
|
|
|
|
"github.com/magefile/mage/sh" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// emoji related constants
|
|
|
|
// emoji related constants
|
|
|
@ -61,8 +62,33 @@ func createEmojiSlice() ([]string, error) { |
|
|
|
return emojiSlice, nil |
|
|
|
return emojiSlice, nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func getRemotePackages() error { |
|
|
|
|
|
|
|
var packages = []string{ |
|
|
|
|
|
|
|
"samhofi.us/x/keybase", |
|
|
|
|
|
|
|
"github.com/awesome-gocui/gocui", |
|
|
|
|
|
|
|
"github.com/magefile/mage/mage", |
|
|
|
|
|
|
|
"github.com/magefile/mage/mg", |
|
|
|
|
|
|
|
"github.com/magefile/mage/sh", |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for _, p := range packages { |
|
|
|
|
|
|
|
if err := sh.Run("go", "get", "-u", p); err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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 emoji lookup support
|
|
|
|
// Build kbtui with emoji lookup support
|
|
|
|
func BuildEmoji() error { |
|
|
|
func BuildEmoji() error { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
emojis, err := createEmojiSlice() |
|
|
|
emojis, err := createEmojiSlice() |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
@ -82,16 +108,9 @@ func BuildEmoji() error { |
|
|
|
return nil |
|
|
|
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.
|
|
|
|
// Build kbtui with just the basic commands.
|
|
|
|
func Build() { |
|
|
|
func Build() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
if err := sh.Run("go", "build"); err != nil { |
|
|
|
if err := sh.Run("go", "build"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
exit(err) |
|
|
|
exit(err) |
|
|
@ -103,6 +122,7 @@ func Build() { |
|
|
|
// The ShowReactions TypeCommand will print a message in the feed window when
|
|
|
|
// The ShowReactions TypeCommand will print a message in the feed window when
|
|
|
|
// a reaction is received in the current conversation.
|
|
|
|
// a reaction is received in the current conversation.
|
|
|
|
func BuildShowReactions() { |
|
|
|
func BuildShowReactions() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil { |
|
|
|
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
exit(err) |
|
|
|
exit(err) |
|
|
@ -115,6 +135,7 @@ func BuildShowReactions() { |
|
|
|
// received in the current conversation. This gets pretty annoying, and
|
|
|
|
// received in the current conversation. This gets pretty annoying, and
|
|
|
|
// is not recommended.
|
|
|
|
// is not recommended.
|
|
|
|
func BuildAutoReact() { |
|
|
|
func BuildAutoReact() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil { |
|
|
|
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
exit(err) |
|
|
|
exit(err) |
|
|
@ -124,6 +145,7 @@ func BuildAutoReact() { |
|
|
|
|
|
|
|
|
|
|
|
// Build kbtui with all commands and TypeCommands disabled.
|
|
|
|
// Build kbtui with all commands and TypeCommands disabled.
|
|
|
|
func BuildAllCommands() { |
|
|
|
func BuildAllCommands() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil { |
|
|
|
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
exit(err) |
|
|
|
exit(err) |
|
|
@ -133,6 +155,7 @@ func BuildAllCommands() { |
|
|
|
|
|
|
|
|
|
|
|
// Build kbtui with all Commands and TypeCommands enabled.
|
|
|
|
// Build kbtui with all Commands and TypeCommands enabled.
|
|
|
|
func BuildAllCommandsT() { |
|
|
|
func BuildAllCommandsT() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil { |
|
|
|
if err := sh.Run("go", "build", "-tags", "type_commands,allcommands"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|
exit(err) |
|
|
|
exit(err) |
|
|
@ -142,6 +165,7 @@ func BuildAllCommandsT() { |
|
|
|
|
|
|
|
|
|
|
|
// Build kbtui with beta functionality
|
|
|
|
// Build kbtui with beta functionality
|
|
|
|
func BuildBeta() { |
|
|
|
func BuildBeta() { |
|
|
|
|
|
|
|
mg.Deps(getRemotePackages) |
|
|
|
mg.Deps(BuildEmoji) |
|
|
|
mg.Deps(BuildEmoji) |
|
|
|
if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil { |
|
|
|
if err := sh.Run("go", "build", "-tags", "allcommands,showreactionscmd,emojiList,tabcompletion"); err != nil { |
|
|
|
defer func() { |
|
|
|
defer func() { |
|
|
|