dotfiles script v0.4.2
- change bash completion from single file to per-directory (~/.bash_completion.d/)
This commit is contained in:
parent
1764e39cb8
commit
9b2fa59ed8
|
|
@ -1,8 +1,11 @@
|
||||||
# ~/.bash_completion - Custom bash auto completions
|
# ~/.bash_completion - Custom bash auto completions
|
||||||
|
|
||||||
# Enable bash completion for dotfiles manager (if installed)
|
shopt -s nullglob
|
||||||
[[ -x "$HOME/bin/dotfiles" ]] && source <($HOME/bin/dotfiles bash-completion)
|
|
||||||
|
|
||||||
# Include host-specific bash_completion
|
# Include all files from ~/.bash_completion.d/
|
||||||
[[ -f ~/.bash_completion.local ]] && source ~/.bash_completion.local
|
if [[ -d ~/.bash_completion.d ]]; then
|
||||||
|
for f in ~/.bash_completion.d/*; do
|
||||||
|
[[ -f "$f" ]] && . "$f"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Enable bash completion for dotfiles manager (if installed)
|
||||||
|
[[ -x "$HOME/bin/dotfiles" ]] && source <($HOME/bin/dotfiles bash-completion)
|
||||||
|
|
||||||
26
bin/dotfiles
26
bin/dotfiles
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
##
|
##
|
||||||
## binaryDiv's dotfiles management script
|
## binaryDiv's dotfiles management script
|
||||||
## Version 0.4.1
|
## Version 0.4.2
|
||||||
##
|
##
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
|
|
@ -74,10 +74,26 @@ case "$cmd" in
|
||||||
echo "! Warning: $bin_dir is not in your PATH."
|
echo "! Warning: $bin_dir is not in your PATH."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate bash completion
|
show_bash_restart_info=
|
||||||
if [[ ! -e "$homedir/.bash_completion" ]]; then
|
|
||||||
echo "* Installing user-defined bash completion"
|
# Enable user-defined bash completion per directory
|
||||||
"$0" link -q .bash_completion &&
|
bashcompletion_filename=.bash_completion
|
||||||
|
if [[ ! -e "$homedir/$bashcompletion_filename" ]]; then
|
||||||
|
echo "* Installing user-defined bash completion (~/.bash_completion.d/)"
|
||||||
|
"$0" link -q "$bashcompletion_filename" &&
|
||||||
|
show_bash_restart_info=1
|
||||||
|
fi
|
||||||
|
mkdir -p "$homedir/.bash_completion.d"
|
||||||
|
|
||||||
|
# Activate dotfiles bash completion
|
||||||
|
bashcompletion_dotfiles_filename=.bash_completion.d/10-dotfiles.sh
|
||||||
|
if [[ ! -e "$homedir/$bashcompletion_dotfiles_filename" ]]; then
|
||||||
|
echo "* Installing bash completion for dotfiles script"
|
||||||
|
"$0" link -q "$bashcompletion_dotfiles_filename" &&
|
||||||
|
show_bash_restart_info=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $show_bash_restart_info ]]; then
|
||||||
echo " Restart bash or run 'source $homedir/.bash_completion' to activate it now"
|
echo " Restart bash or run 'source $homedir/.bash_completion' to activate it now"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue