contrib: bash: completion.bash: add completion for lsbtr

pull/343/head
Asbjørn Apeland 2020-10-31 15:40:23 +01:00
parent 32c04e0b07
commit e4f27632a0
2 changed files with 31 additions and 0 deletions

View File

@ -71,6 +71,9 @@ install-completion:
@echo 'installing bash completion...'
install -d -m 755 "$(DESTDIR)$(BASHCOMPDIR)"
install -p -m 644 contrib/bash/completion.bash "$(DESTDIR)$(BASHCOMPDIR)/$(BIN)"
for name in $(BIN_LINKS); do \
ln -s -n -f $(BIN) "$(DESTDIR)$(BASHCOMPDIR)/$$name"; \
done
install-systemd:
@echo 'installing systemd service units...'

View File

@ -106,4 +106,32 @@ _btrbk()
fi
} && complete -F _btrbk btrbk
_lsbtr()
{
local cur prev words cword split
_init_completion -s || return
case "$prev" in
'-c' | '--config')
_filedir
return
;;
'--override')
return
;;
esac
$split && return
if [[ $cur == -* ]]; then
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
return
else
# <path>|<url>...
_filedir -d
return
fi
} && complete -F _lsbtr lsbtr
# ex: filetype=bash