-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
51 lines (38 loc) · 1.21 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
package main
import (
"flag"
"github.com/tsquare17/devman/internal/commands"
"github.com/tsquare17/devman/internal/output"
"os"
)
const version = "0.2.0"
func main() {
output.Info("DevMan " + version)
var help bool
const helpUsage = "Print this help message."
flag.BoolVar(&help, "help", false, helpUsage)
flag.BoolVar(&help, "h", false, helpUsage + " short-hand")
var versionInput bool
const versionUsage = "Show the version."
flag.BoolVar(&versionInput, "version", false, versionUsage)
flag.BoolVar(&versionInput, "v", false, versionUsage)
var newSiteInput string
const newSiteInputUsage = "Enter the domain of the site to be created."
flag.StringVar(&newSiteInput, "new", "", newSiteInputUsage)
flag.StringVar(&newSiteInput, "n", "", newSiteInputUsage + " short-hand")
var removeSiteInput string
const removeSiteUsage = "Enter the domain of the site to be removed."
flag.StringVar(&removeSiteInput, "remove", "", removeSiteUsage)
flag.StringVar(&removeSiteInput, "rm", "", removeSiteUsage + " short-hand")
flag.Parse()
if help == true {
flag.Usage()
os.Exit(0)
}
if newSiteInput != "" {
commands.NewSite(newSiteInput)
}
if removeSiteInput != "" {
commands.RemoveSite(removeSiteInput)
}
}