-
Notifications
You must be signed in to change notification settings - Fork 0
/
isosceles.go
76 lines (69 loc) · 1.55 KB
/
isosceles.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
package main
import (
"fmt"
"os"
"github.com/murdinc/cli"
"github.com/murdinc/isosceles/active_sync"
"github.com/murdinc/isosceles/config"
)
func main() {
app := cli.NewApp()
app.Name = "isosceles"
app.Usage = "Remote Development Tool"
app.Version = "1.1"
app.Commands = []cli.Command{
{
Name: "active-sync",
ShortName: "as",
Usage: "Actively syncs all configured local folders to their remote",
Action: func(c *cli.Context) error {
log("Reading configuration file...", nil)
cfg, err := config.ReadConfig()
if err != nil {
log("Config File", err)
}
log("Enabled Projects:", nil)
cfg.ListEnabledProjects()
log("Starting Active Sync... press q + return to exit", nil)
active_sync.StartActiveSync(cfg) // blocking
return nil
},
},
{
Name: "all-projects",
ShortName: "ap",
Usage: "List all configured projects",
Action: func(c *cli.Context) error {
cfg, err := config.ReadConfig()
if err != nil {
log("Config File", err)
}
cfg.ListAllProjects()
return nil
},
},
{
Name: "enabled-projects",
ShortName: "ep",
Usage: "List all enabled projects",
Action: func(c *cli.Context) error {
cfg, err := config.ReadConfig()
if err != nil {
log("Config File", err)
}
cfg.ListEnabledProjects()
return nil
},
},
}
app.Run(os.Args)
}
// Log Function
////////////////..........
func log(kind string, err error) {
if err == nil {
fmt.Printf("%s\n", kind)
} else {
fmt.Printf("[ERROR - %s]: %s\n", kind, err)
}
}