This repository has been archived by the owner on Oct 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhandler.go
134 lines (123 loc) · 3 KB
/
handler.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package main
import (
"github.com/5elenay/ezcli"
)
func Handle() {
var handler *ezcli.CommandHandler = ezcli.NewApp("dotman")
handler.AddCommand(&ezcli.Command{
Name: "init",
Description: "initialize the \"dotman.json\" file",
Options: []*ezcli.CommandOption{
{
Name: "description",
Description: "Set the description of the dotfiles (optional)",
Aliases: []string{"d", "desc"},
},
{
Name: "install_path",
Description: "Set the installation path of the dotfiles (optional)",
Aliases: []string{"i", "ip"},
},
{
Name: "remote",
Description: "Set the remote git url of the dotfiles (optional)",
Aliases: []string{"r"},
},
{
Name: "branch",
Description: "Set the installation path of the dotfiles (optional)",
Aliases: []string{"b"},
},
{
Name: "git",
Description: "Initiliaze a git repository for the dotfiles (default: false)",
Aliases: []string{"g"},
},
},
Execute: func(c *ezcli.Command) {
Init(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "add",
Description: "Add a dotfile ",
Options: []*ezcli.CommandOption{
{
Name: "description",
Description: "Set the description of the dotfile (optional)",
Aliases: []string{"d", "desc"},
},
{
Name: "priority",
Description: "Set the priority of the dotfile (optional)",
Aliases: []string{"p", "prio"},
},
},
Execute: func(c *ezcli.Command) {
Add(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "remove",
Description: "Remove a dotfile ",
Aliases: []string{"rm"},
Execute: func(c *ezcli.Command) {
Remove(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "update",
Description: "Update a dotfile ",
Aliases: []string{"up"},
Execute: func(c *ezcli.Command) {
Update(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "command",
Description: "Command utilities",
Aliases: []string{"cmd"},
Options: []*ezcli.CommandOption{
{
Name: "sudo",
Description: "determine the sudo usage for the command",
Aliases: []string{"s"},
},
},
Execute: func(c *ezcli.Command) {
CommandHandler(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "installer",
Description: "installer utilities",
Aliases: []string{"cmd"},
Options: []*ezcli.CommandOption{
{
Name: "description",
Description: "add description",
Aliases: []string{"d"},
},
},
Execute: func(c *ezcli.Command) {
InstallerHandler(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "generate",
Description: "Generates Installer Script",
Aliases: []string{"gen"},
Execute: func(c *ezcli.Command) {
Install(c)
},
})
handler.AddCommand(&ezcli.Command{
Name: "status",
Description: "Shows the status of the dotfiles",
Aliases: []string{"ss"},
Execute: func(c *ezcli.Command) {
Status(c)
},
})
handler.Handle()
}