This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
forked from kigster/bash-it
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_it.sh
executable file
·158 lines (138 loc) · 3.91 KB
/
bash_it.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env bash
# Initialize Bash It
<<<<<<< HEAD
_debug() {
[[ -z $DEBUG ]] && return
echo $*
}
# Reload Library
case $OSTYPE in
darwin*)
alias reload='source ~/.bash_profile'
;;
*)
alias reload='source ~/.bashrc'
;;
esac
=======
>>>>>>> 8feebc0aa901078ec3ed54c94b3b1afc1e8f34ae
# Only set $BASH_IT if it's not already set
if [ -z "$BASH_IT" ];
then
# Setting $BASH to maintain backwards compatibility
# TODO: warn users that they should upgrade their .bash_profile
export BASH_IT=$BASH
BASH="$(bash -c 'echo $BASH')"
export BASH
fi
# For backwards compatibility, look in old BASH_THEME location
if [ -z "$BASH_IT_THEME" ];
then
# TODO: warn users that they should upgrade their .bash_profile
export BASH_IT_THEME="$BASH_THEME";
unset BASH_THEME;
fi
# Load composure first, so we support function metadata
# shellcheck source=./lib/composure.bash
source "${BASH_IT}/lib/composure.bash"
# support 'plumbing' metadata
cite _about _param _example _group _author _version
# libraries, but skip appearance (themes) for now
LIB="${BASH_IT}/lib/*.bash"
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for config_file in $LIB
do
<<<<<<< HEAD
if [ $config_file != $APPEARANCE_LIB ]; then
_debug "loading config file ${config_file}"
=======
if [ "$config_file" != "$APPEARANCE_LIB" ]; then
>>>>>>> 8feebc0aa901078ec3ed54c94b3b1afc1e8f34ae
# shellcheck disable=SC1090
source "$config_file"
fi
done
_debug "loading enabled bash-it plugins"
# Load the global "enabled" directory
_load_global_bash_it_files
# Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion"
do
_debug "load ${bldylw}${file_type}${clr}"
# shellcheck disable=SC1090
_load_bash_it_files $file_type
done
# Load theme, if a theme was set
if [[ ! -z "${BASH_IT_THEME}" ]]; then
# Load colors and helpers first so they can be used in base theme
# shellcheck source=./themes/colors.theme.bash
source "${BASH_IT}/themes/colors.theme.bash"
# shellcheck source=./themes/githelpers.theme.bash
source "${BASH_IT}/themes/githelpers.theme.bash"
# shellcheck source=./themes/p4helpers.theme.bash
source "${BASH_IT}/themes/p4helpers.theme.bash"
# shellcheck source=./themes/base.theme.bash
source "${BASH_IT}/themes/base.theme.bash"
# appearance (themes) now, after all dependencies
# shellcheck source=./lib/appearance.bash
source "$APPEARANCE_LIB"
fi
# Load custom aliases, completion, plugins
for file_type in "aliases" "completion" "plugins"
do
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]
then
# shellcheck disable=SC1090
sourced_file="${BASH_IT}/${file_type}/custom.${file_type}.bash"
_debug "sourcing ${sourced_files}"
source ${sourced_file}
fi
done
# Custom
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
for config_file in $CUSTOM
do
if [ -e "${config_file}" ]; then
# shellcheck disable=SC1090
<<<<<<< HEAD
_debug "sourcing ${config_file}"
source $config_file
=======
source "$config_file"
>>>>>>> 8feebc0aa901078ec3ed54c94b3b1afc1e8f34ae
fi
done
unset config_file
if [[ $PROMPT ]]; then
export PS1="\[""$PROMPT""\]"
fi
# Adding Support for other OSes
PREVIEW="less"
if [ -s /usr/bin/gloobus-preview ]; then
PREVIEW="gloobus-preview"
elif [ -s /Applications/Preview.app ]; then
# shellcheck disable=SC2034
PREVIEW="/Applications/Preview.app"
fi
<<<<<<< HEAD
=======
# Load all the Jekyll stuff
if [ -e "$HOME/.jekyllconfig" ]
then
# shellcheck disable=SC1090
. "$HOME/.jekyllconfig"
fi
# BASH_IT_RELOAD_LEGACY is set.
if ! command -v reload &>/dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then
case $OSTYPE in
darwin*)
alias reload='source ~/.bash_profile'
;;
*)
alias reload='source ~/.bashrc'
;;
esac
fi
>>>>>>> 8feebc0aa901078ec3ed54c94b3b1afc1e8f34ae
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040
set +T