feat(bash): use bash-completion package
This package will pick up completions installed by other packages and will source any local completions from: ~/.local/share/bash-completion/completions
This commit is contained in:
parent
ce16bca279
commit
23c7a7a616
2 changed files with 20 additions and 16 deletions
|
@ -433,17 +433,10 @@ colortest() {
|
|||
stty -ixon # disable ctrl-s and ctrl-q
|
||||
_update_colors "${BACKGROUND:-dark}"
|
||||
|
||||
# Enable available completion helpers
|
||||
# shellcheck disable=SC1090 # no need to shellcheck bash completion files
|
||||
while read -r d; do [ -d "$d" ] && for f in "$d"/*; do [ -f "$f" ] && . "$f"; done; done <<EOL
|
||||
$LOCAL_PREFIX/etc/bash_completion.d
|
||||
$XDG_CONFIG_HOME/bash/completion.d
|
||||
EOL
|
||||
unset d f
|
||||
|
||||
# Source a local bash configuration if available
|
||||
if [ -f "$LOCAL_CONFIG/bash/profile" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
source "$LOCAL_CONFIG/bash/profile"
|
||||
fi
|
||||
while read -r f; do [ -f "$f" ] && source "$f"; done <<EOF
|
||||
/usr/share/bash-completion/bash_completion
|
||||
"$LOCAL_CONFIG/bash/profile"
|
||||
EOF
|
||||
unset f
|
||||
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
- name: Install latest bash (Debian)
|
||||
when: ansible_os_family == "Debian"
|
||||
become: yes
|
||||
apt: name=bash state=latest update_cache=yes
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
loop:
|
||||
- bash
|
||||
- bash-completion
|
||||
|
||||
- name: Install latest bash (macOS)
|
||||
when: ansible_os_family == "Darwin"
|
||||
homebrew: name=bash state=latest
|
||||
homebrew:
|
||||
name: "{{ item }}"
|
||||
state: latest
|
||||
loop:
|
||||
- bash
|
||||
- bash-completion
|
||||
|
||||
- name: Remove pre-installed bash configurations which could cause conflicts
|
||||
file:
|
||||
|
@ -22,7 +33,7 @@
|
|||
loop:
|
||||
- "~/.cache/bash"
|
||||
- "~/.config/bash"
|
||||
- "~/.config/bash/completion.d"
|
||||
- "~/.local/share/bash-completion/completions"
|
||||
|
||||
- name: Deploy bash profile
|
||||
file:
|
||||
|
|
Loading…
Add table
Reference in a new issue