diff --git a/scripts/shell_completions/bash/borg b/scripts/shell_completions/bash/borg index db17fd9af..ec8aeb998 100644 --- a/scripts/shell_completions/bash/borg +++ b/scripts/shell_completions/bash/borg @@ -12,12 +12,13 @@ _borg() local cur="${COMP_WORDS[COMP_CWORD]}" local prev="${COMP_WORDS[COMP_CWORD-1]}" local prevprev="${COMP_WORDS[COMP_CWORD-2]}" - local common_opts="-h --help --critical --error --warning --info -v --verbose --debug --debug-topic -p --progress --iec --log-json --lock-wait --show-version --show-rc --umask --remote-path --upload-ratelimit --upload-buffer --consider-part-files --debug-profile --rsh -r --repo" + local common_opts="-h --help --critical --error --warning --info -v --verbose --debug --debug-topic -p --progress --iec --log-json --lock-wait --show-version --show-rc --umask --remote-path --upload-ratelimit --upload-buffer --debug-profile --rsh -r --repo" + local archive_filter_opts="--sort-by --first --last --oldest --newest --older --newer" local opts="${common_opts}" # Commands if [[ ${COMP_CWORD} == 1 ]] ; then - local borg_commands="benchmark break-lock check compact config create delete diff export-tar extract help import-tar info key list mount prune rcompress rcreate rdelete recreate rename rinfo rlist serve transfer umount with-lock" + local borg_commands="analyze benchmark break-lock check compact create debug delete diff export-tar extract help import-tar info key list mount prune recreate rename repo-compress repo-create repo-delete repo-info repo-list repo-space serve tag transfer umount undelete version with-lock" COMPREPLY=( $(compgen -W "${borg_commands}" -- ${cur}) ) compopt +o default return 0 @@ -32,6 +33,10 @@ _borg() COMPREPLY=( $(compgen -W "cpu crud" -- ${cur}) ) return 0 ;; + 'debug') + COMPREPLY=( $(compgen -W "info dump-archive-items dump-archive dump-manifest dump-repo-objs search-repo-objs get-obj id-hash parse-obj format-obj put-obj delete-obj convert-profile" -- ${cur}) ) + return 0 + ;; 'help') COMPREPLY=( $(compgen -W "patterns placeholders compression" -- ${cur}) ) return 0 @@ -52,12 +57,12 @@ _borg() return 0 ;; '--sort-by') - local sort_keys="timestamp name id" + local sort_keys="timestamp archive name id tags host user" COMPREPLY=( $(compgen -W "${sort_keys}" -- ${cur}) ) return 0 ;; '-o') - # FIXME This list is probably not full, but I tried to pick only those that are relevant to borg mount -o: + # FIXME This list is probably not complete, but I tried to pick only those that are relevant to borg mount -o: local fuse_options="ac_attr_timeout= allow_damaged_files allow_other allow_root attr_timeout= auto auto_cache auto_unmount default_permissions entry_timeout= gid= group_id= kernel_cache max_read= negative_timeout= noauto noforget remember= remount rootmode= uid= umask= user user_id= versions" COMPREPLY=( $(compgen -W "${fuse_options}" -- ${cur}) ) return 0 @@ -69,36 +74,42 @@ _borg() ;; '--upgrader') local upgraders="From12To20 NoOp" - COMPREPLY=( $(compgren -W "${upgraders}" -- ${cur}) ) + COMPREPLY=( $(compgen -W "${upgraders}" -- ${cur}) ) return 0 ;; esac if [[ ${cur} == -* ]] ; then case "${COMP_LINE}" in - *' rcreate '*) - local opts="--other-repo -e --encryption --append-only --storage-quota --make-parent-dirs --copy-crypt-key ${common_opts}" + *' analyze '*) + local opts="-a --match-archives ${archive_filter_opts} ${common_opts}" ;; - *' rlist '*) - local opts="--consider-checkpoints --short --format --json ${common_opts} -a --match-archives --sort-by --first --last" + *' repo-create '*) + local opts="--other-repo --from-borg1 -e --encryption --copy-crypt-key ${common_opts}" ;; - *' rinfo '*) + *' repo-list '*) + local opts="--short --format --json ${common_opts} -a --match-archives ${archive_filter_opts} --deleted" + ;; + *' repo-info '*) local opts="--json ${common_opts}" ;; - *' rcompress '*) - local opts="-C --compression -s --stats -c --checkpoint-interval ${common_opts}" + *' repo-compress '*) + local opts="-C --compression -s --stats ${common_opts}" ;; - *' rdelete '*) + *' repo-delete '*) local opts="-n --dry-run --list --force --cache-only --keep-security-info ${common_opts}" ;; + *' repo-space '*) + local opts="--reserve --free ${common_opts}" + ;; *' create '*) - local opts="-n --dry-run -s --stats --list --filter --json --no-cache-sync --stdin-name --stdin-user --stdin-group --stdin-mode --content-from-command --paths-from-stdin --paths-from-command --paths-delimiter -e --exclude --exclude-from --pattern --patterns-from --exclude-caches --exclude-if-present --keep-exclude-tags --exclude-nodump -x --one-file-system --numeric-ids --atime --noctime --nobirthtime --noflags --noacls --noxattrs --sparse --files-cache --read-special --comment --timestamp -c --checkpoint-interval --chunker-params -C --compression ${common_opts}" + local opts="-n --dry-run -s --stats --list --filter --json --stdin-name --stdin-user --stdin-group --stdin-mode --content-from-command --paths-from-stdin --paths-from-command --paths-delimiter -e --exclude --exclude-from --pattern --patterns-from --exclude-caches --exclude-if-present --keep-exclude-tags --exclude-nodump -x --one-file-system --numeric-ids --atime --noctime --nobirthtime --noflags --noacls --noxattrs --sparse --files-cache --read-special --comment --timestamp --chunker-params -C --compression ${common_opts}" ;; *' extract '*) local opts="--list -n --dry-run --numeric-ids --noflags --noacls --noxattrs --stdout --sparse -e --exclude --exclude-from --pattern --patterns-from --strip-components ${common_opts}" ;; *' check '*) - local opts="--repository-only --archives-only --verify-data --repair --max-duration -a --match-archives --sort-by --first --last ${common_opts}" + local opts="--repository-only --archives-only --verify-data --repair --find-lost-archives --max-duration -a --match-archives ${archive_filter_opts} ${common_opts}" ;; # rename # no specific options @@ -109,19 +120,19 @@ _borg() local opts="--numeric-ids --same-chunker-params --sort --json-lines -e --exclude --exclude-from --pattern --patterns-from ${common_opts}" ;; *' delete '*) - local opts="-n --dry-run --list --consider-checkpoints -s --stats --cache-only --force -c --checkpoint-interval -a --match-archives --sort-by --first --last ${common_opts}" + local opts="-n --dry-run --list -s --stats --cache-only --force -a --match-archives ${archive_filter_opts} ${common_opts}" ;; *' prune '*) - local opts="-n --dry-run --force -s --stats --list --keep-within --keep-last --keep-secondly --keep-minutely -H --keep-hourly -d --keep-daily -w --keep-weekly -m --keep-monthly -y --keep-yearly -c --checkpoint-interval -a --match-archives ${common_opts}" + local opts="-n --dry-run --force -s --stats --list --keep-within --keep-last --keep-secondly --keep-minutely -H --keep-hourly -d --keep-daily -w --keep-weekly -m --keep-monthly --keep-13weekly --keep-3monthly -y --keep-yearly -a --match-archives ${common_opts}" ;; *' compact '*) - local opts="--threshold ${common_opts}" + local opts="-n --dry-run -s --stats ${common_opts}" ;; *' info '*) - local opts="--json -a --match-archives --sort-by --first --last ${common_opts}" + local opts="--json -a --match-archives ${archive_filter_opts} ${common_opts}" ;; *' mount '*) - local opts="--consider-checkpoints -f --foreground -o --numeric-ids -a --match-archives --sort-by --first --last -e --exclude --exclude-from --pattern --patterns-from --strip-components ${common_opts}" + local opts="-f --foreground -o --numeric-ids -a --match-archives ${archive_filter_opts} -e --exclude --exclude-from --pattern --patterns-from --strip-components ${common_opts}" ;; # umount # no specific options @@ -137,23 +148,30 @@ _borg() local opts="--paper ${common_opts}" ;; *' recreate '*) - local opts="--list --filter -n dry-run -s stats -e exclude --exclude-from --pattern --patterns-from --exclude-caches --exclude-if-present --keep-exclude-tags -a --match-archives --sort-by --first --last --target -c --checkpoint-interval --comment --timestamp -C --compression --recompress --chunker-params ${common_opts}" + local opts="--list --filter -n --dry-run -s --stats -e --exclude --exclude-from --pattern --patterns-from --exclude-caches --exclude-if-present --keep-exclude-tags -a --match-archives ${archive_filter_opts} --target --comment --timestamp -C --compression --chunker-params ${common_opts}" ;; *' export-tar '*) - local opts="--tar-filter --list --tar-format -e exclude --exclude-from --pattern --patterns-from --strip-components ${common_opts}" + local opts="--tar-filter --list --tar-format -e --exclude --exclude-from --pattern --patterns-from --strip-components ${common_opts}" ;; *' import-tar '*) - local opts="--tar-filter -s --stats --list --filter --json ${common_opts} --comment --timestamp -c --checkpoint-interval --chunker-params -C --compression" + local opts="--tar-filter -s --stats --list --filter --json --ignore-zeros ${common_opts} --comment --timestamp --chunker-params -C --compression" ;; *' transfer '*) - local opts="-n --dry-run --other-repo --upgrader ${common_opts} -a --match-archives --sort-by --first --last" + local opts="-n --dry-run --other-repo --upgrader ${common_opts} -a --match-archives ${archive_filter_opts}" ;; *' serve '*) local opts="--restrict-to-path --restrict-to-repository --append-only --storage-quota ${common_opts}" ;; - *' config '*) - local opts="-c --cache -d --delete --list ${common_opts}" + *' tag '*) + local opts="--set --add --remove -a --match-archives ${archive_filter_opts} ${common_opts}" ;; + *' undelete '*) + local opts="-n --dry-run --list -a --match-archives ${archive_filter_opts} ${common_opts}" + ;; + # debug + # has subcommands, handled separately + # version + # no specific options # with-lock # no specific options # break-lock