Repository: syncthing/syncthing (language: go)

Issue:
Support listing the discovered devices using the cli
When you click on "Add Remote Device" in the web GUI, it displays a list of discovered devices on the local network that can be added. As far as I can tell there is no equivalent for `syncthing cli`. Perhaps `syncthing cli show connections` could be made to support an optional `--show-discovered` argument?


Discussion / hints:
That is discovery packets observed over time, so this would only be accessible from the running instance I guess.
Well the data is already available over the REST API: https://docs.syncthing.net/rest/system-discovery-get.html
I think the request is about making it easier to access through the cli command.
> I think the request is about making it easier to access through the cli command.

That's correct. :-)
I guess I just don't see how this is generally useful. 
Seems like a niche request for which rest doesn't sound crazy?
@jwatt what's your use case around this?  Any specific reason why `curl` wouldn't cut it?
Do we really need to discuss anything here? We have a cli, this is an operation that exists in our API, it wouldn't hurt to have it, at least someone wants it -> lets keep it as a feature request. If we get a ton of such requests, we can create an umbrella ticket "Implement rest api methods in the cli" and redirect new issues to that - but I don't see that happening for now.
> @jwatt what's your use case around this? Any specific reason why `curl` wouldn't cut it?

Since I'm just a user, I looked at the [intro docs](https://docs.syncthing.net/intro/) and [user docs](https://docs.syncthing.net/users/), didn't find a solution there, then discovering the `cli` command via `syncthing -h`. The REST docs are collapsed under the "Development" section of the documentation on the website, so I wasn't even aware there was a REST API. (I don't consider my basic initial setup task to be "development".)

In addition to not being super obvious/discoverable for a beginner user, the REST/curl-based solution doesn't have great ergonomics, either in construction of the command line (there's no command auto-completion, so you have to: find, open and grok the REST docs...copy and paste the curl command and HTTP header from the docs...open the config file and copy and paste the apikey...identify then copy and paste the relevant endpoint from the docs), or great ergonomics in the necessity for parsing of JSON if the user is creating their own setup script.

It also raises the technical barrier for CLI users who aren't familiar with REST/curl.

For an inexperienced first-time Syncthing user trying to get through the initial setup and needing some very basic information (the device ID of the other machine on my LAN), the above friction seems a bit rough. If I was trying to fiddle with some obscure configuration as a more experienced user that would be a different thing.

Anyway, just trying to provide insight into my first-time user experience in the hopes you guys can use it to make Syncthing even more approachable and awesome. Make of it what you will. :-) Thanks for your contributions, regardless of the outcome here.
Yeah, that complexity is roughly appropriate for something in the "development" chapter. Users are expected to use the web UI, that is much simpler.

Out of curiousity, what would you do on the command line after getting the the discovered ID? Probably also use the cli to add the device? Is that the level of complexity you'd be comfortable with? Note that the CLI is pretty young and not a central design part, as maybe with Git or Docker. 
@acolomb Sorry, I missed your reply.

Yes, I would then like to use the cli to add the device, I think. I should actually run through a full setup though and get back to you if there's other unavailable functionality that would seem to make sense. I've just been a bit busy but I'll try to get around to that soon and let you know!
To follow-up on the above, the main issue for me is lack of CLI support for making settings changes to existing devices and folders. (For example, to pause a folder.) I've filed #8060 to track that.

Fix patch:
diff --git a/cmd/syncthing/cli/show.go b/cmd/syncthing/cli/show.go
index dc739250aa3..b49f6b1d192 100644
--- a/cmd/syncthing/cli/show.go
+++ b/cmd/syncthing/cli/show.go
@@ -35,6 +35,11 @@ var showCommand = cli.Command{
 			Usage:  "Report about connections to other devices",
 			Action: expects(0, indexDumpOutput("system/connections")),
 		},
+		{
+			Name:   "discovery",
+			Usage:  "Show the discovered addresses of remote devices (from cache of the running syncthing instance)",
+			Action: expects(0, indexDumpOutput("system/discovery")),
+		},
 		pendingCommand,
 		{
 			Name:   "usage",


Test patch: