mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 23:13:25 +00:00
Added shell completions for borg help
This commit is contained in:
parent
075600d65d
commit
1383459a08
3 changed files with 25 additions and 2 deletions
|
@ -17,7 +17,7 @@ _borg()
|
|||
|
||||
# Commands
|
||||
if [[ ${COMP_CWORD} == 1 ]] ; then
|
||||
local borg_commands="init create extract check rename list diff delete prune info mount umount key serve upgrade recreate export-tar with-lock break-lock benchmark config"
|
||||
local borg_commands="init create extract check rename list diff delete prune info mount umount key serve upgrade recreate export-tar with-lock break-lock config benchmark help"
|
||||
COMPREPLY=( $(compgen -W "${borg_commands}" -- ${cur}) )
|
||||
compopt +o default
|
||||
return 0
|
||||
|
@ -32,6 +32,10 @@ _borg()
|
|||
COMPREPLY=( $(compgen -W "crud" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
'help')
|
||||
COMPREPLY=( $(compgen -W "patterns placeholders compression" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
'--encryption' | '-e')
|
||||
local encryption_modes="none keyfile keyfile-blake2 repokey repokey-blake2 authenticated authenticated-blake2"
|
||||
COMPREPLY=( $(compgen -W "${encryption_modes}" -- ${cur}) )
|
||||
|
|
|
@ -50,6 +50,17 @@ end
|
|||
complete -c borg -f -n __fish_is_first_token -a 'benchmark' -d 'Benchmark borg operations'
|
||||
complete -c borg -f -n __fish_borg_seen_benchmark -a 'crud' -d 'Benchmark borg CRUD operations'
|
||||
|
||||
function __fish_borg_seen_help
|
||||
if __fish_seen_subcommand_from help
|
||||
and not __fish_seen_subcommand_from patterns placeholders compression
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
complete -c borg -f -n __fish_is_first_token -a 'help' -d 'Miscellaneous Help'
|
||||
complete -c borg -f -n __fish_borg_seen_help -a 'patterns' -d 'Help for patterns'
|
||||
complete -c borg -f -n __fish_borg_seen_help -a 'placeholders' -d 'Help for placeholders'
|
||||
complete -c borg -f -n __fish_borg_seen_help -a 'compression' -d 'Help for compression'
|
||||
|
||||
# Common options
|
||||
complete -c borg -f -s h -l 'help' -d 'Show help information'
|
||||
|
@ -309,6 +320,8 @@ complete -c borg -f -l 'list' -d 'List the configuration o
|
|||
# borg benchmark
|
||||
# no specific options
|
||||
|
||||
# borg help
|
||||
# no specific options
|
||||
|
||||
# List archives
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ _borg() {
|
|||
--consider-part-files'[treat part files like normal files (e.g. to list/extract them)]'
|
||||
--debug-profile'[Write execution profile in Borg format into FILE.]:_files')
|
||||
|
||||
borg_possible_commands=(init create extract check rename list diff delete prune info mount umount key upgrade recreate export-tar serve config with-lock break-lock benchmark)
|
||||
borg_possible_commands=(init create extract check rename list diff delete prune info mount umount key upgrade recreate export-tar serve config with-lock break-lock benchmark help)
|
||||
borg_possible_key_commands=(change-passphrase import export)
|
||||
command=""
|
||||
keyCommand=""
|
||||
|
@ -370,6 +370,11 @@ _borg() {
|
|||
'4:path:_files'\
|
||||
$borg_common_options
|
||||
;;
|
||||
(help)
|
||||
_arguments \
|
||||
'2:type:(patterns placeholders compression )'\
|
||||
$borg_common_options
|
||||
;;
|
||||
*)
|
||||
commands=(
|
||||
'init:initialize empty repository'
|
||||
|
@ -393,6 +398,7 @@ _borg() {
|
|||
'with-lock:run user command with lock held'
|
||||
'break-lock:break repository and cache locks'
|
||||
'benchmark:benchmark command'
|
||||
'help:miscellaneous help'
|
||||
)
|
||||
|
||||
_describe 'values' commands
|
||||
|
|
Loading…
Reference in a new issue