-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
57 lines (48 loc) · 1.19 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
54
55
56
57
package main
import (
"fmt"
"log"
"os"
"smg/cmd/comm"
"smg/cmd/config"
"smg/cmd/tui"
)
const ProgramVersion = "0.04"
func menu_help () {
fmt.Println("smg v"+ProgramVersion)
fmt.Println("Simple SSH Manager with Go")
fmt.Println("Program repository: github.com/cybertramp/smg\n")
fmt.Println(" help: Manual for this program")
fmt.Println(" init: Make default connection config file")
fmt.Println(" add : Add new connection item")
}
func menu_init () {
config.MakeConnFile()
}
func menu_add() {
config_file_path := config.GetConnFilePath()
conn_json := config.LoadConnFile(config_file_path)
tui.Run(config_file_path, conn_json, comm.TuiAddItem)
}
func menu_main() {
config_file_path := config.GetConnFilePath()
conn_json := config.LoadConnFile(config_file_path)
tui.Run(config_file_path, conn_json, comm.TuiMain)
}
func main() {
args := os.Args
if len(args) > 1 {
switch args[1]{
case "help":
menu_help()
case "init":
menu_init()
case "add":
menu_add()
default:
log.Fatalln("This command not support!")
}
}else{
menu_main()
}
}