Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Extract loading of enable-able files and add reload_* functions

  • Loading branch information...
commit b524bb604756d33ec330abe5300a7a1a6d3a833b 1 parent 1372e7d
Travis Swicegood authored
12  bash_it.sh
@@ -35,17 +35,7 @@ done
35 35
 # Load enabled aliases, completion, plugins
36 36
 for file_type in "aliases" "completion" "plugins"
37 37
 do
38  
-  if [ ! -d "${BASH_IT}/${file_type}/enabled" ]
39  
-  then
40  
-    continue
41  
-  fi
42  
-  FILES="${BASH_IT}/${file_type}/enabled/*.bash"
43  
-  for config_file in $FILES
44  
-  do
45  
-    if [ -e "${config_file}" ]; then
46  
-      source $config_file
47  
-    fi
48  
-  done
  38
+  _load_bash_it_files $file_type
49 39
 done
50 40
 
51 41
 # Load any custom aliases that the user has added
30  lib/helpers.bash
... ...
@@ -0,0 +1,30 @@
  1
+# Helper function loading various enable-able files
  2
+function _load_bash_it_files() {
  3
+  file_type="$1"
  4
+  if [ ! -d "${BASH_IT}/${file_type}/enabled" ]
  5
+  then
  6
+    continue
  7
+  fi
  8
+  FILES="${BASH_IT}/${file_type}/enabled/*.bash"
  9
+  for config_file in $FILES
  10
+  do
  11
+    if [ -e "${config_file}" ]; then
  12
+      source $config_file
  13
+    fi
  14
+  done
  15
+}
  16
+
  17
+# Function for reloading aliases
  18
+function reload_aliases() {
  19
+  _load_bash_it_files "aliases"
  20
+}
  21
+
  22
+# Function for reloading auto-completion
  23
+function reload_completion() {
  24
+  _load_bash_it_files "completion"
  25
+}
  26
+
  27
+# Function for reloading plugins
  28
+function reload_plugins() {
  29
+  _load_bash_it_files "plugins"
  30
+}

0 notes on commit b524bb6

Please sign in to comment.
Something went wrong with that request. Please try again.