-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
106 lines (102 loc) · 2.52 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
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
package main
import (
"github.com/urfave/cli/v2"
"github.com/xEtarusx/xplane-gateway-downloader/app"
"log"
"os"
)
func main() {
action := app.Action{}
a := &cli.App{
Name: "X-Plane Gateway Downloader",
HelpName: "xplane-gateway-downloader",
Usage: "Download airports from X-Plane Gateway with ease",
Description: "Update airport sceneries from the X-Plane Gateway",
Commands: []*cli.Command{
{
Name: "install",
Usage: "Install a new airport scenery pack",
Action: func(c *cli.Context) error {
return action.Process(c, app.ActionInstall)
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "The `path` to the config.json",
Value: "config.json",
},
&cli.StringFlag{
Name: "icao",
Aliases: []string{"i"},
Usage: "Install an airport by `ICAO` code",
},
},
},
{
Name: "update",
Usage: "Update all installed airport scenery packs",
Action: func(c *cli.Context) error {
return action.Process(c, app.ActionUpdate)
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "The `path` to the config.json",
Value: "config.json",
},
},
},
{
Name: "uninstall",
Usage: "Uninstall an installed airport scenery pack",
Action: func(c *cli.Context) error {
return action.Process(c, app.ActionUninstall)
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "The `path` to the config.json",
Value: "config.json",
},
&cli.StringFlag{
Name: "icao",
Aliases: []string{"i"},
Usage: "Uninstall an airport by `ICAO` code",
},
},
},
{
Name: "config",
Usage: "Configure the application",
Action: func(c *cli.Context) error {
return action.Process(c, app.ActionConfig)
},
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Usage: "The `path` to the config.json",
Value: "config.json",
},
&cli.StringFlag{
Name: "custom-scenery-folder",
Aliases: []string{"csf"},
Usage: "The `path` to CustomScenery folder of x-plane",
},
&cli.StringFlag{
Name: "x-plane-version",
Aliases: []string{"v"},
Usage: "Set the current `version` of x-plane",
},
},
},
},
}
err := a.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}