Skip to content

Document missing CLI option flags and use double-dash consistently. - #692

Merged
acolomb merged 3 commits into
syncthing:mainfrom
acolomb:fix-option-dashes
Nov 3, 2021
Merged

acolomb merged 3 commits into
syncthing:mainfrom
acolomb:fix-option-dashes

Conversation

@acolomb

@acolomb acolomb commented Nov 3, 2021

Copy link
Copy Markdown
Member

The command-line help output lists all options formatted with --double-dashes. Although Syncthing actually accepts both single and double dash forms, I think keeping consistency between CLI help and docs helps avoid confusion.

The same changes could probably be done for stdiscosrv and strelaysrv, as well as the build.go script documentation. They seem to accept double dashes as well, but print the single dash in their help output.

Newly documented options:

  • --log-max-files
  • --log-max-size
  • --allow-newer-config
  • --no-upgrade
  • --gui-apikey

One important fix is in the syncthing command synopsis, where [device-id] was looking like an optional argument to be specified, because of the missing dash(es).

Most notably in the syncthing man page, the --device-id option was
missing the dashes completely, misleading the reader to think it's a
non-option argument.

@imsodin imsodin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Comment thread users/syncthing.rst
Comment on lines -12 to +20
syncthing [-audit] [-auditfile=<file|-|-->] [-browser-only] [device-id]
[-generate=<dir>] [-gui-address=<address>] [-gui-apikey=<key>]
[-home=<dir> | -config=<dir> -data=<dir>]
[-logfile=<filename>] [-logflags=<flags>]
[-no-browser] [-no-console] [-no-restart] [-paths] [-paused]
[-reset-database] [-reset-deltas] [-unpaused] [-upgrade]
[-upgrade-check] [-upgrade-to=<url>] [-verbose] [-version]
syncthing [--audit] [--auditfile=<file|-|-->] [--browser-only] [--device-id]
[--generate=<dir>] [--gui-address=<address>] [--gui-apikey=<key>]
[--home=<dir> | --config=<dir> --data=<dir>]
[--logfile=<filename>] [--logflags=<flags>]
[--log-max-files=<num>] [--log-max-size=<num>]
[--no-browser] [--no-console] [--no-restart] [--paths] [--paused]
[--reset-database] [--reset-deltas] [--unpaused] [--allow-newer-config]
[--upgrade] [--no-upgrade] [--upgrade-check] [--upgrade-to=<url>]
[--verbose] [--version]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still legacy usage, the new way would be using syncthing cli, and display options/help generated from that cli here. Might be possible to adapt syncthing --help output (and syncthing serve --help), possibly even auto-generating it. And having docs for the other sub-commands, but that's clearly out-of-scope here :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I'm working on at least a manual take at documenting the other subcommands right now. That's when I found some inconsistencies, see syncthing/syncthing#8037.

Auto-generating stuff would be neat, and AFAICT the urfave/cli package supports that approach and stuff like bash-completions as well. But as long as the repositories are separated, that automation step will be really hard I suppose. So focusing on fixups right now.

My main motivation and starting point btw. was having any mention of syncthing cli at all in the docs, pointing to its self-explanatory help system at the very least.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you say this is "legacy" usage? It's still 100 % valid for the serve command?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping @imsodin ?

@acolomb
acolomb merged commit 0485651 into syncthing:main Nov 3, 2021
@acolomb
acolomb deleted the fix-option-dashes branch November 3, 2021 23:02
@syncthing syncthing locked and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants