aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorTeddy Wing2023-11-14 20:46:46 +0100
committerTeddy Wing2023-11-14 20:46:46 +0100
commit5611b8d2f99782ebf6e690a4d563be256b9c0762 (patch)
treee471272cc1a81f8e2496e728c13472d1890fe6e6 /cmd
parent6870f1670820eec7fd2aa9fa77a301c69ea944b6 (diff)
downloadswextreload-5611b8d2f99782ebf6e690a4d563be256b9c0762.tar.bz2
Make `--reload-current-tab` flag work
Make the tab reload work based on the flag instead of always reloading.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/swextreload/main.go11
1 files changed, 7 insertions, 4 deletions
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)