From 2b72adc5437810bc7446f5f64209cecf70fdb8c2 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Tue, 29 Oct 2019 18:21:07 +0100 Subject: [PATCH] Extract sourcing of bash completion helpers into a function --- dotfiles/.bashrc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dotfiles/.bashrc b/dotfiles/.bashrc index 36536a5..1cb8b38 100644 --- a/dotfiles/.bashrc +++ b/dotfiles/.bashrc @@ -280,6 +280,15 @@ bashrc_customize_ls() { fi } +bashrc_source_completion_helpers() { + if [ -d /usr/local/etc/bash_completion.d ]; then + local f + for f in /usr/local/etc/bash_completion.d/*; do + source "$f" + done + fi +} + # Print the solarized palette (for testing) solarized() { local names=(Base02 Red Green Yellow Blue Magenta Cyan Base2 @@ -336,13 +345,7 @@ bashrc_customize_aliases bashrc_customize_terminal_colors bashrc_customize_prompt bashrc_customize_ls - -# Source any available completion helpers -if [ -d /usr/local/etc/bash_completion.d ]; then - for f in /usr/local/etc/bash_completion.d/*; do - source "$f" - done -fi +bashrc_source_completion_helpers # Source a local bashrc if available if [ -f "$HOME/.bashrc.local" ]; then