-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
69 lines (59 loc) · 1.31 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
package main
import (
_ "embed"
"log"
"os"
"github.com/mitchellh/colorstring"
"github.com/paranoco/pnc/vpn"
"github.com/urfave/cli/v2"
)
var version string = "dev"
//go:embed help_app.template
var appHelpTemplate string
//go:embed help_command.template
var commandHelpTemplate string
//go:embed help_subcommand.template
var subcommandHelpTemplate string
func main() {
cli.AppHelpTemplate = colorstring.Color(appHelpTemplate)
cli.CommandHelpTemplate = colorstring.Color(commandHelpTemplate)
cli.SubcommandHelpTemplate = colorstring.Color(subcommandHelpTemplate)
app := &cli.App{
Name: "pnc",
Version: version,
HideVersion: false,
Usage: "paranoco toolbelt",
Commands: []*cli.Command{
{
Name: "vpn",
Usage: "connect to a configured VPN",
Action: vpn.VpnCommand,
},
{
Name: "vpn-config",
Usage: "configure a VPN to connect to",
Action: vpn.VpnConfigCommand,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "set-vpn",
},
},
},
{
Name: "public-ip",
Aliases: []string{"ip"},
Usage: "prints your public IPv4",
Action: PublicIpCommand,
},
{
Name: "status",
Usage: "prints configuration status",
Action: vpn.StatusCommand,
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}