Add more help when user submit incorrect or obsolete command line arguments.#9541
Add more help when user submit incorrect or obsolete command line arguments.#9541gmatht wants to merge 7 commits intoborgbackup:masterfrom
Conversation
When --repo uses legacy repo::archive syntax, show list and repo-info style examples.
Replace useless repo-info bullet with path reasons; add InvalidRepository guidance; get_message returns full text.
Invalid subcommand synonyms/fuzzy hints, argv-based examples, Common fixes for repo::archive and flags before subcommand, repo-create encryption reminder.
preprocess_args: glob-archives and related hints with example; omit Rust version branding.
Add cli_guidance and argparsing hint tests; adjust repository remote tests; manual UX smoke script.
|
@gmatht Thanks for the PR and working on this. I think this first needs an ISSUE being filed with a description of the problem. You can then refer to that issue from this PR comment (or from a commit comment) using ", fixes #XXXX". The PR comment as it is now (wall of text) is not acceptable. |
|
Some more feedback:
|
|
As is the canary in master isn't very useful as rorg was a back-of-the-envelope port of Borg to rust. The outcome seemed to be that moving from sequential to Rayon helped a lot, but for whatever reason my Rust was slower single threaded than your Cython. I doubt you'll care what that breaks since you are unlikely to want to merge that. I guess I could move the experimental work into a branch and only put potentially merge worthy commits into master. Also, should I break up the commits by the subheadings above e.g. commit -m 'Extra help: Borg1 init used on Borg2'? |
|
Sorry, I have a hard time parsing your answer. This is a PR to borg (not rorg) and we want the canary here. Also, this is way too much and should be limited to "valid borg 1.x command" -> borg2 help. It does not even need to cover all command/option changes, the most popular ones would be good enough. If somebody uses something rare, they can also just read the docs. |
|
Ah I see. I tried to disable the canary on the rorg master but somehow it seems to have been appended to this pull request instead. FYI, My understanding was that this pull request was denied, and that I should flesh out what is actually required on the related Issue instead. (And then issue a pull request for only the simpler commits for the suggested features). |
Description
Adds help when user submits incorrect or obsolete command line arguments.
For example on this branch error messages look like:
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: argument : invalid choice: 'init' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
Common fixes:
repo-createnotinit:borg --repo /tmp/demo-repo repo-create -e repokey-aes-ocb
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: argument : invalid choice: 'rcreate' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
Common fixes:
repo-createnotrcreate:borg --repo /tmp/demo-repo repo-create -e repokey-aes-ocb
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: argument : invalid choice: 'repo-creat' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
Common fixes:
repo-createnotrepo-creat:borg repo-create
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: argument : invalid choice: 'repoo-list' (choose from 'analyze', 'benchmark', 'check', 'compact', 'completion', 'create', 'debug', 'delete', 'diff', 'extract', 'help', 'info', 'key', 'list', 'break-lock', 'with-lock', 'mount', 'umount', 'prune', 'repo-compress', 'repo-create', 'repo-delete', 'repo-info', 'repo-list', 'recreate', 'rename', 'repo-space', 'serve', 'tag', 'export-tar', 'import-tar', 'transfer', 'undelete', 'version')
Common fixes:
repo-listnotrepoo-list:borg repo-list
Common fixes:
usage: borg [options] list [-h] [--critical] [--error] [--warning] [--info]
[--debug] [--debug-topic TOPIC] [-p] [--iec]
[--log-json] [--lock-wait SECONDS] [--show-version]
[--show-rc] [--umask M] [--remote-path PATH]
[--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER]
[--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO] [--short]
[--format FORMAT] [--json-lines] [--depth N]
[-e PATTERN] [--exclude-from EXCLUDEFILE]
[--pattern PATTERN] [--patterns-from PATTERNFILE]
NAME [PATH ...]
tip: For details of accepted options run: borg list --help
error: argument NAME: Invalid archive name: "my" [invalid chars detected matching "/"<|>?*"]
Common fixes:
usage: borg [options] create [-h] [--critical] [--error] [--warning] [--info]
[--debug] [--debug-topic TOPIC] [-p] [--iec]
[--log-json] [--lock-wait SECONDS]
[--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER]
[--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO] [-n] [-s] [--list]
[--filter STATUSCHARS] [--json]
[--stdin-name NAME] [--stdin-user USER]
[--stdin-group GROUP] [--stdin-mode M]
[--content-from-command] [--paths-from-stdin]
[--paths-from-command]
[--paths-from-shell-command]
[--paths-delimiter DELIM] [-e PATTERN]
[--exclude-from EXCLUDEFILE] [--pattern PATTERN]
[--patterns-from PATTERNFILE] [--exclude-caches]
[--exclude-if-present NAME] [--keep-exclude-tags]
[-x] [--numeric-ids] [--atime] [--noctime]
[--nobirthtime] [--noflags] [--noacls]
[--noxattrs] [--sparse] [--files-cache MODE]
[--files-changed MODE] [--read-special]
[--comment COMMENT] [--timestamp TIMESTAMP]
[--chunker-params PARAMS] [-C COMPRESSION]
[--hostname HOSTNAME] [--username USERNAME]
[--tags TAG [TAG ...]]
NAME [PATH ...]
tip: For details of accepted options run: borg create --help
error: Unrecognized arguments: --remote-ratelimit
borg --repo /tmp/demo-repo repo-create
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: Option 'repo-create.encryption' is required but not provided or its value is None.
Use -e/--encryption to choose a mode, for example: -e repokey-aes-ocb
Available encryption modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305
borg --repo /tmp/demo-repo::test1 list
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: argument -r/--repo: Invalid location format: "/tmp/demo-repo::test1".
Common fixes:
borg list --repo /tmp/demo-repo list ::test1
OR
export BORG_REPO=/tmp/demo-repo
borg list ::test1
Repository /tmp/does-not-exist does not exist.
Common fixes:
export BORG_REPO=/tmp/does-not-exist
borg repo-create -e repokey-aes-ocb
Available -e modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: Option 'list.paths' is required but not provided or its value is None.
Common fixes:
borg repo-create --repo /tmp/does-not-exist -e repokey-aes-ocb
Available -e modes: none, authenticated, authenticated-blake2, keyfile-aes-ocb, repokey-aes-ocb, keyfile-chacha20-poly1305, repokey-chacha20-poly1305, keyfile-blake2-aes-ocb, repokey-blake2-aes-ocb, keyfile-blake2-chacha20-poly1305, repokey-blake2-chacha20-poly1305
usage: borg [--config CONFIG] [--print_config �[=flags]] [-V] [--cockpit] [-h]
[--critical] [--error] [--warning] [--info] [--debug]
[--debug-topic TOPIC] [-p] [--iec] [--log-json]
[--lock-wait SECONDS] [--show-version] [--show-rc] [--umask M]
[--remote-path PATH] [--upload-ratelimit RATE]
[--upload-buffer UPLOAD_BUFFER] [--debug-profile FILE] [--rsh RSH]
[--socket [PATH]] [-r REPO]
...
tip: For details of accepted options run: borg --help
error: Option 'list.paths' is required but not provided or its value is None.
borg list requires an archive NAME to list contents.
Common fixes:
Checklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)