-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmage.go
101 lines (90 loc) · 2.25 KB
/
mage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// +build mage
package main
import (
"fmt"
"os"
"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
)
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",
"github.com/pelletier/go-toml",
}
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 just the basic commands.
func Build() {
mg.Deps(getRemotePackages)
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() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "showreactionscmd"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with the basec commands, and the AutoReact "TypeCommand".
// The AutoReact TypeCommand will automatically react to every message
// received in the current conversation. This gets pretty annoying, and
// is not recommended.
func BuildAutoReact() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "autoreactcmd"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with all commands and TypeCommands disabled.
func BuildAllCommands() {
mg.Deps(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "allcommands"); err != nil {
defer func() {
exit(err)
}()
}
}
// Build kbtui with all Commands and TypeCommands enabled.
func BuildAllCommandsT() {
mg.Deps(getRemotePackages)
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(getRemotePackages)
if err := sh.Run("go", "build", "-tags", "allcommands showreactionscmd tabcompletion execcmd"); err != nil {
defer func() {
exit(err)
}()
}
}