From 5611b8d2f99782ebf6e690a4d563be256b9c0762 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Tue, 14 Nov 2023 20:46:46 +0100 Subject: Make `--reload-current-tab` flag work Make the tab reload work based on the flag instead of always reloading. --- cmd/swextreload/main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cmd') diff --git a/cmd/swextreload/main.go b/cmd/swextreload/main.go index 0ccd0f9..66a589b 100644 --- a/cmd/swextreload/main.go +++ b/cmd/swextreload/main.go @@ -21,9 +21,10 @@ func main() { Description: "DevTools protocol WebSocket URL", }, { - LongName: "reload-current-tab", - Type: "bool", - Description: "pass this to reload the active Chrome tab", + LongName: "reload-current-tab", + Type: "bool", + DefaultValue: false, + Description: "pass this to reload the active Chrome tab", }, { LongName: "version", @@ -63,6 +64,8 @@ func main() { os.Exit(sysexits.Usage) } + shouldReloadTab := args["reload-current-tab"].(bool) + extension_ids := args["extension_id"].([]string) if len(extension_ids) == 0 { fmt.Fprintln(os.Stderr, "error: missing extension IDs") @@ -81,7 +84,7 @@ func main() { err = swextreload.Reload( socket_url, extension_ids, - true, + shouldReloadTab, ) if err != nil { fmt.Fprintf(os.Stderr, "error: can't reload extension: %v\n", err) -- cgit v1.2.3