Repository: syncthing/syncthing (language: go)

Issue:
"syncthing cli config devices add" reflect error when using --addresses flag
### Does your log mention database corruption?

Nay

### Include required information

I'm attempting to use the CLI to add a device. This device can be added via the GUI, and the address(es) also work within the GUI.

```syncthing cli config devices add --device-id GYRZZQB-IRNPV4Z-T7TC52W-EQYJ3TT-FDQW6MW-DFLMU42-SSSU6EM-FBK2VAY --name MyDevice --addresses tcp://example.com:22000```

Removing the `--addresses tcp://example.com:22000` will cause the cli call to work correctly. 

Other forms that also error:
`--addresses 'tcp://example.com:22000'`
`--addresses "tcp://example.com:22000"`
`--addresses tcp://example.com`
`--addresses tcp://192.168.1.6:22000`
`--addresses "tcp://192.168.1.6:22000"`
`--addresses tcp://192.168.1.6`

Please be sure to include at least:
 - Raspberry Pi 4B, raspbian lite, syncthing v1.20.4, Linux (64-bit ARM)
 - ssh to the pi via Win 10 powershell (latest)

The console output:

```log
pi@raspberrypi:~ $ syncthing cli config devices add --device-id GYRZZQB-IRNPV4Z-T7TC52W-EQYJ3TT-FDQW6MW-DFLMU42-SSSU6EM-FBK2VAY --name MyDevice --addresses tcp://example.com:22000
panic: reflect: call of reflect.Value.Elem on slice Value

goroutine 1 [running]:
reflect.Value.Elem({0x8d3f80?, 0x400017e830?, 0x40002dbdb8?})
        reflect/value.go:1213 +0x1a8
github.com/AudriusButkevicius/recli.(*constructor).makeSliceItemBuilders.func1(0x40002a0c60)
        github.com/AudriusButkevicius/recli@v0.0.6/recli.go:391 +0x270
github.com/AudriusButkevicius/recli.expectArgs.func1(0x400027bd20?)
        github.com/AudriusButkevicius/recli@v0.0.6/utils.go:154 +0xe4
github.com/urfave/cli.HandleAction({0x91ae80?, 0x40002d47f8?}, 0x3?)
        github.com/urfave/cli@v1.22.5/app.go:522 +0xa0
github.com/urfave/cli.Command.Run({{0xa3cbb3, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xa5ca58, 0x1c}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:173 +0x534
github.com/urfave/cli.(*App).RunAsSubcommand(0x40001a2c40, 0x40002a09a0)
        github.com/urfave/cli@v1.22.5/app.go:405 +0x6fc
github.com/urfave/cli.Command.startApp({{0x40002daff0, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:372 +0x668
github.com/urfave/cli.Command.Run({{0x40002daff0, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:102 +0x694
github.com/urfave/cli.(*App).RunAsSubcommand(0x40001a2a80, 0x40002a0840)
        github.com/urfave/cli@v1.22.5/app.go:405 +0x6fc
github.com/urfave/cli.Command.startApp({{0xa3fed8, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xa6b660, 0x28}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:372 +0x668
github.com/urfave/cli.Command.Run({{0xa3fed8, 0x6}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xa6b660, 0x28}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:102 +0x694
github.com/urfave/cli.(*App).RunAsSubcommand(0x40001a28c0, 0x40002a06e0)
        github.com/urfave/cli@v1.22.5/app.go:405 +0x6fc
github.com/urfave/cli.Command.startApp({{0xa3cbe9, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xa61ccf, 0x20}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:372 +0x668
github.com/urfave/cli.Command.Run({{0xa3cbe9, 0x3}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0xa61ccf, 0x20}, {0x0, ...}, ...}, ...)
        github.com/urfave/cli@v1.22.5/command.go:102 +0x694
github.com/urfave/cli.(*App).Run(0x40001a2700, {0x4000128000, 0xb, 0xb})
        github.com/urfave/cli@v1.22.5/app.go:277 +0x630
github.com/syncthing/syncthing/cmd/syncthing/cli.Run()
        github.com/syncthing/syncthing/cmd/syncthing/cli/main.go:134 +0x7f0
main.main()
        github.com/syncthing/syncthing/cmd/syncthing/main.go:216 +0x80

goroutine 34 [chan receive]:
github.com/syncthing/notify.(*nonrecursiveTree).dispatch(0x400011c480, 0x0?)
        github.com/syncthing/notify@v0.0.0-20210616190510-c6b7342338d2/tree_nonrecursive.go:36 +0x40
created by github.com/syncthing/notify.newNonrecursiveTree
        github.com/syncthing/notify@v0.0.0-20210616190510-c6b7342338d2/tree_nonrecursive.go:29 +0x158

goroutine 35 [chan receive]:
github.com/syncthing/notify.(*nonrecursiveTree).internal(0x400011c480, 0x400011c420)
        github.com/syncthing/notify@v0.0.0-20210616190510-c6b7342338d2/tree_nonrecursive.go:81 +0x3c
created by github.com/syncthing/notify.newNonrecursiveTree
        github.com/syncthing/notify@v0.0.0-20210616190510-c6b7342338d2/tree_nonrecursive.go:30 +0x1b0

goroutine 36 [sleep]:
time.Sleep(0x1dcd6500)
        runtime/time.go:194 +0x124
github.com/syncthing/syncthing/lib/dialer.init.1.func2()
        github.com/syncthing/syncthing/lib/dialer/internal.go:43 +0x28
created by github.com/syncthing/syncthing/lib/dialer.init.1
        github.com/syncthing/syncthing/lib/dialer/internal.go:42 +0xf0

goroutine 38 [IO wait]:
internal/poll.runtime_pollWait(0x7f5e7dbfe8, 0x72)
        runtime/netpoll.go:302 +0xa4
internal/poll.(*pollDesc).wait(0x400017ce80?, 0x4000291000?, 0x0)
        internal/poll/fd_poll_runtime.go:83 +0x2c
internal/poll.(*pollDesc).waitRead(...)
        internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0x400017ce80, {0x4000291000, 0x1000, 0x1000})
        internal/poll/fd_unix.go:167 +0x1ec
net.(*netFD).Read(0x400017ce80, {0x4000291000?, 0x40000a1c58?, 0x15590?})
        net/fd_posix.go:55 +0x2c
net.(*conn).Read(0x400011a268, {0x4000291000?, 0x0?, 0x400011a260?})
        net/net.go:183 +0x38
net/http.(*persistConn).Read(0x400027ac60, {0x4000291000?, 0x15640?, 0x40000a4000?})
        net/http/transport.go:1929 +0x54
bufio.(*Reader).fill(0x400029ce40)
        bufio/bufio.go:106 +0x100
bufio.(*Reader).Peek(0x400029ce40, 0x1)
        bufio/bufio.go:144 +0x6c
net/http.(*persistConn).readLoop(0x400027ac60)
        net/http/transport.go:2093 +0x160
created by net/http.(*Transport).dialConn
        net/http/transport.go:1750 +0x1214

goroutine 39 [select]:
net/http.(*persistConn).writeLoop(0x400027ac60)
        net/http/transport.go:2392 +0xa4
created by net/http.(*Transport).dialConn
        net/http/transport.go:1751 +0x1260
```




Discussion / hints:
I am getting this same error on Windows Server 2019 and syncthing@1.20.4
@AudriusButkevicius PRed a fix in recli: https://github.com/AudriusButkevicius/recli/pull/1
Hi I'm facing this issue as well on syncthing v.123.4 as well . Does it fixed yet?
Ah yes, it was only fixed upstream but never pulled in.

@AudriusButkevicius can you do a patch release for recli please?
```
diff --git a/go.mod b/go.mod
index a21cad4e3..74acc972e 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.19

 require (
        github.com/AudriusButkevicius/pfilter v0.0.11
-       github.com/AudriusButkevicius/recli v0.0.6
+       github.com/AudriusButkevicius/recli v0.0.7-0.20220911121932-d000ce8fbf0f
        github.com/alecthomas/kong v0.7.1
        github.com/calmh/incontainer v0.0.0-20221224152218-b3e71b103d7a
        github.com/calmh/xdr v1.1.0
```

?

Fix patch:
diff --git a/go.mod b/go.mod
index a21cad4e362..74acc972e53 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/AudriusButkevicius/pfilter v0.0.11
-	github.com/AudriusButkevicius/recli v0.0.6
+	github.com/AudriusButkevicius/recli v0.0.7-0.20220911121932-d000ce8fbf0f
 	github.com/alecthomas/kong v0.7.1
 	github.com/calmh/incontainer v0.0.0-20221224152218-b3e71b103d7a
 	github.com/calmh/xdr v1.1.0
diff --git a/go.sum b/go.sum
index 768286594a6..e2a73f366a7 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
 github.com/AudriusButkevicius/pfilter v0.0.11 h1:6emuvqNeH1gGlqkML35pEizyPcaxdAN4JO9sdgwcx78=
 github.com/AudriusButkevicius/pfilter v0.0.11/go.mod h1:4eF1UYuEhoycTlr9IOP1sb0lL9u4nfAIouRqt2xJbzM=
-github.com/AudriusButkevicius/recli v0.0.6 h1:hY9KH09vIbx0fYpkvdWbvnh67uDiuJEVDGhXlefysDQ=
-github.com/AudriusButkevicius/recli v0.0.6/go.mod h1:Nhfib1j/VFnLrXL9cHgA+/n2O6P5THuWelOnbfPNd78=
+github.com/AudriusButkevicius/recli v0.0.7-0.20220911121932-d000ce8fbf0f h1:GmH5lT+moM7PbAJFBq57nH9WJ+wRnBXr/tyaYWbSAx8=
+github.com/AudriusButkevicius/recli v0.0.7-0.20220911121932-d000ce8fbf0f/go.mod h1:Nhfib1j/VFnLrXL9cHgA+/n2O6P5THuWelOnbfPNd78=
 github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
 github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=


Test patch: