diff options
author | Teddy Wing | 2023-11-14 20:33:49 +0100 |
---|---|---|
committer | Teddy Wing | 2023-11-14 20:33:49 +0100 |
commit | fdae4c43486baa7baefea409725563c55b8b08a2 (patch) | |
tree | 55e444a89dd245d12800a069fb3653c8a77e2f08 /cmd | |
parent | 567690761b5783195be9e7f7c6d47589fdf6f7ea (diff) | |
download | swextreload-fdae4c43486baa7baefea409725563c55b8b08a2.tar.bz2 |
Add `--debug` flag
Condition printing debug output on the presence of this flag.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/swextreload/main.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/cmd/swextreload/main.go b/cmd/swextreload/main.go index 1b56eb6..f11a1e1 100644 --- a/cmd/swextreload/main.go +++ b/cmd/swextreload/main.go @@ -31,6 +31,12 @@ func main() { Type: "bool", Description: "show the program version", }, + { + LongName: "debug", + Type: "bool", + DefaultValue: false, + Description: "print debug output", + }, }, Positionals: []claw.Positional{ { @@ -46,8 +52,6 @@ func main() { log.Fatal(err) } - log.Printf("args: %#v", args) - socket_url, ok := args["socket-url"].(string) if !ok { fmt.Fprintln(os.Stderr, "error: '--socket-url' is required") @@ -60,6 +64,15 @@ func main() { os.Exit(sysexits.Usage) } + isDebug := args["debug"].(bool) + if isDebug { + swextreload.SetDebugOn() + } + + if isDebug { + log.Printf("args: %#v", args) + } + err = swextreload.Reload( socket_url, extension_ids, |