linting clean up

pull/1762/head
cornfeedhobo 2021-01-03 19:49:34 -06:00
parent 3addebb66b
commit 4f7fc134ad
No known key found for this signature in database
GPG Key ID: 724357093F994B26
2 changed files with 81 additions and 87 deletions

View File

@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Initialize Bash It # Initialize Bash It
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
# Only set $BASH_IT if it's not already set # Only set $BASH_IT if it's not already set
if [ -z "$BASH_IT" ]; if [[ -z "$BASH_IT" ]]; then
then # Setting $BASH to maintain backwards compatibility
# Setting $BASH to maintain backwards compatibility export BASH_IT=$BASH
export BASH_IT=$BASH BASH="$(bash -c 'echo $BASH')"
BASH="$(bash -c 'echo $BASH')" export BASH
export BASH BASH_IT_OLD_BASH_SETUP=true
BASH_IT_OLD_BASH_SETUP=true
fi fi
# Load composure first, so we support function metadata # Load composure first, so we support function metadata
@ -20,14 +20,13 @@ source "${BASH_IT}/lib/composure.bash"
source "${BASH_IT}/lib/log.bash" source "${BASH_IT}/lib/log.bash"
# We can only log it now # We can only log it now
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!" [[ -z "$BASH_IT_OLD_BASH_SETUP" ]] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
# For backwards compatibility, look in old BASH_THEME location # For backwards compatibility, look in old BASH_THEME location
if [ -z "$BASH_IT_THEME" ]; if [[ -z "$BASH_IT_THEME" ]]; then
then _log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!" export BASH_IT_THEME="$BASH_THEME"
export BASH_IT_THEME="$BASH_THEME"; unset BASH_THEME
unset BASH_THEME;
fi fi
# support 'plumbing' metadata # support 'plumbing' metadata
@ -37,16 +36,15 @@ cite _about _param _example _group _author _version
_log_debug "Loading libraries(except appearance)..." _log_debug "Loading libraries(except appearance)..."
LIB="${BASH_IT}/lib/*.bash" LIB="${BASH_IT}/lib/*.bash"
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash" APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for _bash_it_config_file in $LIB for _bash_it_config_file in $LIB; do
do if [[ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]]; then
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then filename=${_bash_it_config_file##*/}
filename=${_bash_it_config_file##*/} filename=${filename%.bash}
filename=${filename%.bash} BASH_IT_LOG_PREFIX="lib: ${filename}: "
BASH_IT_LOG_PREFIX="lib: ${filename}: " _log_debug "Loading library file..."
_log_debug "Loading library file..." # shellcheck disable=SC1090
# shellcheck disable=SC1090 source "$_bash_it_config_file"
source "$_bash_it_config_file" fi
fi
done done
# Load the global "enabled" directory # Load the global "enabled" directory
@ -55,100 +53,95 @@ done
source "${BASH_IT}/scripts/reloader.bash" source "${BASH_IT}/scripts/reloader.bash"
# Load enabled aliases, completion, plugins # Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion" for file_type in "aliases" "plugins" "completion"; do
do # shellcheck source=./scripts/reloader.bash
# shellcheck source=./scripts/reloader.bash source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type"
source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type"
done done
# Load theme, if a theme was set # Load theme, if a theme was set
if [[ ! -z "${BASH_IT_THEME}" ]]; then if [[ -n "${BASH_IT_THEME}" ]]; then
_log_debug "Loading \"${BASH_IT_THEME}\" theme..." _log_debug "Loading \"${BASH_IT_THEME}\" theme..."
# Load colors and helpers first so they can be used in base theme # Load colors and helpers first so they can be used in base theme
BASH_IT_LOG_PREFIX="themes: colors: " BASH_IT_LOG_PREFIX="themes: colors: "
# shellcheck source=./themes/colors.theme.bash # shellcheck source=./themes/colors.theme.bash
source "${BASH_IT}/themes/colors.theme.bash" source "${BASH_IT}/themes/colors.theme.bash"
BASH_IT_LOG_PREFIX="themes: githelpers: " BASH_IT_LOG_PREFIX="themes: githelpers: "
# shellcheck source=./themes/githelpers.theme.bash # shellcheck source=./themes/githelpers.theme.bash
source "${BASH_IT}/themes/githelpers.theme.bash" source "${BASH_IT}/themes/githelpers.theme.bash"
BASH_IT_LOG_PREFIX="themes: p4helpers: " BASH_IT_LOG_PREFIX="themes: p4helpers: "
# shellcheck source=./themes/p4helpers.theme.bash # shellcheck source=./themes/p4helpers.theme.bash
source "${BASH_IT}/themes/p4helpers.theme.bash" source "${BASH_IT}/themes/p4helpers.theme.bash"
BASH_IT_LOG_PREFIX="themes: command_duration: " BASH_IT_LOG_PREFIX="themes: command_duration: "
# shellcheck source=./themes/command_duration.theme.bash # shellcheck source=./themes/command_duration.theme.bash
source "${BASH_IT}/themes/command_duration.theme.bash" source "${BASH_IT}/themes/command_duration.theme.bash"
BASH_IT_LOG_PREFIX="themes: base: " BASH_IT_LOG_PREFIX="themes: base: "
# shellcheck source=./themes/base.theme.bash # shellcheck source=./themes/base.theme.bash
source "${BASH_IT}/themes/base.theme.bash" source "${BASH_IT}/themes/base.theme.bash"
BASH_IT_LOG_PREFIX="lib: appearance: " BASH_IT_LOG_PREFIX="lib: appearance: "
# appearance (themes) now, after all dependencies # appearance (themes) now, after all dependencies
# shellcheck source=./lib/appearance.bash # shellcheck source=./lib/appearance.bash
source "$APPEARANCE_LIB" source "$APPEARANCE_LIB"
fi fi
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading custom aliases, completion, plugins..." _log_debug "Loading custom aliases, completion, plugins..."
for file_type in "aliases" "completion" "plugins" for file_type in "aliases" "completion" "plugins"; do
do if [[ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]]; then
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ] BASH_IT_LOG_PREFIX="${file_type}: custom: "
then _log_debug "Loading component..."
BASH_IT_LOG_PREFIX="${file_type}: custom: " # shellcheck disable=SC1090
_log_debug "Loading component..." source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
# shellcheck disable=SC1090 fi
source "${BASH_IT}/${file_type}/custom.${file_type}.bash"
fi
done done
# Custom # Custom
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading general custom files..." _log_debug "Loading general custom files..."
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash" CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
for _bash_it_config_file in $CUSTOM for _bash_it_config_file in $CUSTOM; do
do if [[ -e "${_bash_it_config_file}" ]]; then
if [ -e "${_bash_it_config_file}" ]; then filename=$(basename "${_bash_it_config_file}")
filename=$(basename "${_bash_it_config_file}") filename=${filename%*.bash}
filename=${filename%*.bash} BASH_IT_LOG_PREFIX="custom: $filename: "
BASH_IT_LOG_PREFIX="custom: $filename: " _log_debug "Loading custom file..."
_log_debug "Loading custom file..." # shellcheck disable=SC1090
# shellcheck disable=SC1090 source "$_bash_it_config_file"
source "$_bash_it_config_file" fi
fi
done done
unset _bash_it_config_file unset _bash_it_config_file
if [[ $PROMPT ]]; then if [[ $PROMPT ]]; then
export PS1="\[""$PROMPT""\]" export PS1="\[""$PROMPT""\]"
fi fi
# Adding Support for other OSes # Adding Support for other OSes
PREVIEW="less" PREVIEW="less"
if [ -s /usr/bin/gloobus-preview ]; then if [[ -s /usr/bin/gloobus-preview ]]; then
PREVIEW="gloobus-preview" PREVIEW="gloobus-preview"
elif [ -s /Applications/Preview.app ]; then elif [[ -s /Applications/Preview.app ]]; then
# shellcheck disable=SC2034 # shellcheck disable=SC2034
PREVIEW="/Applications/Preview.app" PREVIEW="/Applications/Preview.app"
fi fi
# Load all the Jekyll stuff # Load all the Jekyll stuff
if [ -e "$HOME/.jekyllconfig" ] if [[ -e "$HOME/.jekyllconfig" ]]; then
then # shellcheck disable=SC1090
# shellcheck disable=SC1090 source "$HOME/.jekyllconfig"
. "$HOME/.jekyllconfig"
fi fi
# BASH_IT_RELOAD_LEGACY is set. # BASH_IT_RELOAD_LEGACY is set.
if ! command -v reload &>/dev/null && [ -n "$BASH_IT_RELOAD_LEGACY" ]; then if ! command -v reload &> /dev/null && [[ -n "$BASH_IT_RELOAD_LEGACY" ]]; then
case $OSTYPE in case $OSTYPE in
darwin*) darwin*)
alias reload='source ~/.bash_profile' alias reload='source ~/.bash_profile'
;; ;;
*) *)
alias reload='source ~/.bashrc' alias reload='source ~/.bashrc'
;; ;;
esac esac
fi fi
# Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040 # Disable trap DEBUG on subshells - https://github.com/Bash-it/bash-it/pull/1040

View File

@ -21,6 +21,7 @@ docs
# root files # root files
# #
.gitattributes .gitattributes
bash_it.sh
lint_clean_files.sh lint_clean_files.sh
# themes # themes