-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (43 loc) · 1.19 KB
/
main.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
package main
import (
"fmt"
"os"
"github.com/clawio/clawioctl/commands"
"github.com/codegangsta/cli"
)
// Build information obtained with the help of -ldflags
var (
buildDate string // date -u
gitTag string // git describe --exact-match HEAD
gitNearestTag string // git describe --abbrev=0 --tags HEAD
gitCommit string // git rev-parse HEAD
)
func main() {
app := cli.NewApp()
app.Authors = []cli.Author{
cli.Author{
Name: "Hugo González Labrador",
Email: "[email protected]",
},
}
app.Copyright = "GNU Affero General Public License v3.0"
app.Name = "clawioctl"
app.Usage = `
The ClawIO Controller is the unified tool to manage your ClawIO services from a terminal.
`
app.Commands = []cli.Command{
commands.ConfigureCommand,
commands.CleanCommand,
commands.DataCommands,
commands.MetaDataCommands,
}
app.Version = getVersion(app)
app.Run(os.Args)
}
func getVersion(app *cli.App) string {
// if gitTag is not empty we are on release build
if gitTag != "" {
return fmt.Sprintf("%s %s commit:%s release-build\n", app.Name, gitNearestTag, gitCommit)
}
return fmt.Sprintf("%s %s commit:%s dev-build\n", app.Name, gitNearestTag, gitCommit)
}