-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
53 lines (44 loc) · 1.51 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
53
package main
import (
"fmt"
"os"
"github.com/smartrecruiters/rabbitr/cmd/message"
"github.com/smartrecruiters/rabbitr/cmd/commons"
"github.com/smartrecruiters/rabbitr/cmd/connection"
"github.com/smartrecruiters/rabbitr/cmd/exchange"
"github.com/smartrecruiters/rabbitr/cmd/policy"
"github.com/smartrecruiters/rabbitr/cmd/queue"
"github.com/smartrecruiters/rabbitr/cmd/server"
"github.com/smartrecruiters/rabbitr/cmd/shovel"
"github.com/urfave/cli"
)
const (
applicationName = "rabbitr"
applicationDescription = "CLI application for easier management of RabbitMQ related tasks"
)
var (
version string
commit string
date string
)
func versionString() string {
return fmt.Sprintf("%s, commit %s, built at %s", version, commit, date)
}
func main() {
app := cli.NewApp()
app.Name = applicationName
app.Usage = applicationDescription
app.Version = versionString()
app.Commands = connection.GetCommands()
app.Commands = append(app.Commands, exchange.GetCommands()...)
app.Commands = append(app.Commands, message.GetCommands()...)
app.Commands = append(app.Commands, policy.GetCommands()...)
app.Commands = append(app.Commands, queue.GetCommands()...)
app.Commands = append(app.Commands, server.GetCommands()...)
app.Commands = append(app.Commands, shovel.GetCommands()...)
cli.AppHelpTemplate = commons.GetAppHelpTemplate()
cli.CommandHelpTemplate = commons.GetCommandHelpTemplate()
cli.SubcommandHelpTemplate = commons.GetSubcommandHelpTemplate()
err := app.Run(os.Args)
commons.AbortIfError(err)
}