-
Notifications
You must be signed in to change notification settings - Fork 3
/
bitadmin.go
71 lines (55 loc) · 1.49 KB
/
bitadmin.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
package main
import (
"os"
"sort"
"github.com/daeMOn63/bitadmin/commands/cache"
"github.com/daeMOn63/bitadmin/commands/group"
"github.com/daeMOn63/bitadmin/commands/hooks"
"github.com/daeMOn63/bitadmin/commands/repository"
"github.com/daeMOn63/bitadmin/commands/user"
"github.com/daeMOn63/bitadmin/helper"
"github.com/daeMOn63/bitadmin/settings"
"github.com/fatih/color"
"github.com/urfave/cli"
)
func main() {
globalSettings := settings.NewSettings()
app := cli.NewApp()
app.EnableBashCompletion = true
app.Name = "bitadmin"
app.Usage = "Bitbucket cli administration tool"
app.Version = "0.0.1"
app.Author = "Flavien Binet"
app.Email = "https://github.com/daeMOn63/bitadmin"
app.Flags = globalSettings.GetFlags()
cacheCommand := &cache.Command{
Settings: globalSettings,
}
repositoryCommand := &repository.Command{
Settings: globalSettings,
}
userCommand := &user.Command{
Settings: globalSettings,
}
groupCommand := &group.Command{
Settings: globalSettings,
}
hooksCommand := &hooks.Command{
Settings: globalSettings,
}
app.Commands = []cli.Command{
cacheCommand.GetCommand(),
repositoryCommand.GetCommand(),
userCommand.GetCommand(),
groupCommand.GetCommand(),
hooksCommand.GetCommand(),
}
app.BashComplete = helper.AppAutoComplete
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.CommandsByName(app.Commands))
err := app.Run(os.Args)
if err != nil {
color.New(color.FgRed).Fprintf(cli.ErrWriter, "\nError: %s\n", err.Error())
os.Exit(1)
}
}