diff --git a/Makefile b/Makefile index 118286f..e3346d0 100644 --- a/Makefile +++ b/Makefile @@ -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...' diff --git a/contrib/bash/completion.bash b/contrib/bash/completion.bash index 2a68d51..558ed45 100644 --- a/contrib/bash/completion.bash +++ b/contrib/bash/completion.bash @@ -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 + # |... + _filedir -d + return + fi +} && complete -F _lsbtr lsbtr + # ex: filetype=bash