aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swextreload/main.go
blob: b1702f6932d898b8c5c22ad3e37a029346908f6c (plain)
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
package main

import (
	"log"

	"git.sr.ht/~liliace/claw"
	swextreload "gopkg.teddywing.com/swextreload/internal"
)

func main() {
	args, err := claw.Parse(&claw.Options{
		Name:        "swextreload",
		Description: "Reload Google Chrome extensions.",
		Flags: []claw.Flag{
			{
				LongName:    "socket-url",
				Type:        "string",
				Description: "DevTools protocol WebSocket URL",
			},
			{
				LongName:    "reload-current-tab",
				Type:        "bool",
				Description: "pass this to reload the active Chrome tab",
			},
			{
				LongName:    "version",
				ShortName:   'V',
				Type:        "bool",
				Description: "show the program version",
			},
		},
		Positionals: []claw.Positional{
			{
				Name:        "extension_id",
				Type:        "string",
				Repeating:   true,
				Description: "extensions to reload",
			},
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("args: %#v", args)
	return

	err = swextreload.Reload(
		"ws://127.0.0.1:55755/devtools/browser/4536efdf-6ddf-40b6-9a16-258a1935d866",
		"imcibeelfmccdpnnlemllnepgbfdbkgo",
		true,
	)
	if err != nil {
		log.Fatal(err)
	}
}