-
Notifications
You must be signed in to change notification settings - Fork 3
/
ssgo.go
47 lines (40 loc) · 1.19 KB
/
ssgo.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
package main
import (
"fmt"
"os"
utils "github.com/devils2ndself/SSGo/utils"
flag "github.com/spf13/pflag"
)
const version string = "1.0.3"
func main() {
var (
input string = ""
output string = utils.DefaultOutput
displayHelp bool = false
displayVersion bool = false
config string = ""
)
// Flag initialization
flag.StringVarP(&input, "input", "i", "", utils.InputHelpMessage)
flag.StringVarP(&output, "output", "o", utils.DefaultOutput, utils.OutputHelpMessage)
flag.BoolVarP(&displayHelp, "help", "h", false, utils.HelpHelpMessage)
flag.BoolVarP(&displayVersion, "version", "v", false, utils.VersionHelpMessage)
flag.StringVarP(&config, "config", "c", "", utils.ConfigHelpMessage)
flag.Parse()
if len(os.Args) == 1 {
fmt.Println("Usage: ssgo -i [path] -o [out path]\nHelp: ssgo [-h | --help]")
os.Exit(1)
} else {
if config != "" {
utils.ProcessConfig(config)
} else if input != "" {
utils.ProcessInput(input, output)
} else if displayHelp {
utils.PrintHelp()
} else if displayVersion {
fmt.Println("SSGo version " + version)
} else {
fmt.Println("Invalid call. Use 'ssgo [-h | --help]' for available commands.")
}
}
}