-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (50 loc) · 1.06 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
package main
import (
"log"
"os"
"github.com/furtidev/tplinkctl/wr840n"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "tplinkctl",
Usage: "control your TP-Link router from the command line.",
UsageText: "tplinkctl [ROUTER MODEL] --user <username> --pass <password>",
Version: "0.1",
Commands: []*cli.Command{
{
Name: "wr840n",
Usage: "control your TL-WR840N router.",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "user",
Value: "admin",
Usage: "username to login to your panel",
},
&cli.StringFlag{
Name: "pass",
Value: "admin",
Usage: "password to login to your panel",
},
},
Before: wr840n.Setup,
Action: wr840n.Status,
Subcommands: []*cli.Command {
{
Name: "clients",
Usage: "check connected DHCP clients.",
Action: wr840n.Clients,
},
{
Name: "reboot",
Usage: "reboot the router.",
Action: wr840n.Reboot,
},
},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatalf("Error: %s", err)
}
}