Add more help when user submit incorrect or obsolete command line arguments.#9541
Open
gmatht wants to merge 6 commits intoborgbackup:masterfrom
Open
Add more help when user submit incorrect or obsolete command line arguments.#9541gmatht wants to merge 6 commits intoborgbackup:masterfrom
gmatht wants to merge 6 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)