2.0 and --skip-port-probing

I was testing Syncthing 2.0 (rc16) together with “Syncthing Windows Setup”, and stumbled upon an error message. It turns out Bill uses the command syncthing.exe generate --skip-port-probing --home= to create a config.xml in the case of a new install.

However, with syncthing 2.0.0-rc.16 you get the following error message: syncthing.exe: error: unknown flag --skip-port-probing

Is that flag removed in ST 2.0?

Apparently, yes. (I mean, I did it, I just didn’t remember).

% syncthing generate --help
Usage: syncthing generate [flags]

Generate key and config, then exit

Flags:
  -h, --help                   Show context-sensitive help.
  -C, --config=PATH            Set configuration directory (config and keys) ($STCONFDIR)
  -D, --data=PATH              Set data directory (database and logs) ($STDATADIR)
  -H, --home=PATH              Set configuration and data directory ($STHOMEDIR)

      --gui-user=STRING        Specify new GUI authentication user name
      --gui-password=STRING    Specify new GUI authentication password (use - to read from standard input)
      --no-port-probing        Don't try to find free ports for GUI and listen addresses on first startup ($STNOPORTPROBING)

I think this is a carryover from the main serve command where we already had numerous --no-whatever but no --skip-whatevers.

Great, thanks!

1 Like

Hm. Followup question: If someone wants to support both Syncthing 1 and 2, we must be able to query the executable for what version it is.

But Syncthing 1 does that using the flag “--version”, and Syncthing 2 uses the command “version”. Both gives an error if you do it the wrong way.

Is there a backwards-compatible way (except by dealing with the errors) to query for version?

I suppose that, since the use case is only for new installs, one could skip the version check altogether. But this is still an interesting question…

I thin running syncthing version and getting an error back is a fine indicator that it’s not a v2 build, but if that irks you I’m sure you can match on something in the --help output.

1 Like

I’m just an end-user, not trying to write a wrapper or anything, but can you re-consider making syncthing --version work with 2.0 (in addition to syncthing version)? It’s kind of a standard for many/most CLI apps, along with --help, and I quite often type it (in general, maybe not with syncthing specifically) to find out the version of something.

2 Likes