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,10 +1,10 @@
#!/usr/bin/env bash
# Initialize Bash It
BASH_IT_LOG_PREFIX="core: main: "
# Only set $BASH_IT if it's not already set
if [ -z "$BASH_IT" ];
then
if [[ -z "$BASH_IT" ]]; then
# Setting $BASH to maintain backwards compatibility
export BASH_IT=$BASH
BASH="$(bash -c 'echo $BASH')"
@ -20,14 +20,13 @@ source "${BASH_IT}/lib/composure.bash"
source "${BASH_IT}/lib/log.bash"
# 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
if [ -z "$BASH_IT_THEME" ];
then
if [[ -z "$BASH_IT_THEME" ]]; then
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
export BASH_IT_THEME="$BASH_THEME";
unset BASH_THEME;
export BASH_IT_THEME="$BASH_THEME"
unset BASH_THEME
fi
# support 'plumbing' metadata
@ -37,9 +36,8 @@ cite _about _param _example _group _author _version
_log_debug "Loading libraries(except appearance)..."
LIB="${BASH_IT}/lib/*.bash"
APPEARANCE_LIB="${BASH_IT}/lib/appearance.bash"
for _bash_it_config_file in $LIB
do
if [ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]; then
for _bash_it_config_file in $LIB; do
if [[ "$_bash_it_config_file" != "$APPEARANCE_LIB" ]]; then
filename=${_bash_it_config_file##*/}
filename=${filename%.bash}
BASH_IT_LOG_PREFIX="lib: ${filename}: "
@ -55,14 +53,13 @@ done
source "${BASH_IT}/scripts/reloader.bash"
# Load enabled aliases, completion, plugins
for file_type in "aliases" "plugins" "completion"
do
for file_type in "aliases" "plugins" "completion"; do
# shellcheck source=./scripts/reloader.bash
source "${BASH_IT}/scripts/reloader.bash" "skip" "$file_type"
done
# 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..."
# Load colors and helpers first so they can be used in base theme
BASH_IT_LOG_PREFIX="themes: colors: "
@ -89,10 +86,8 @@ fi
BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading custom aliases, completion, plugins..."
for file_type in "aliases" "completion" "plugins"
do
if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]
then
for file_type in "aliases" "completion" "plugins"; do
if [[ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ]]; then
BASH_IT_LOG_PREFIX="${file_type}: custom: "
_log_debug "Loading component..."
# shellcheck disable=SC1090
@ -104,9 +99,8 @@ done
BASH_IT_LOG_PREFIX="core: main: "
_log_debug "Loading general custom files..."
CUSTOM="${BASH_IT_CUSTOM:=${BASH_IT}/custom}/*.bash ${BASH_IT_CUSTOM:=${BASH_IT}/custom}/**/*.bash"
for _bash_it_config_file in $CUSTOM
do
if [ -e "${_bash_it_config_file}" ]; then
for _bash_it_config_file in $CUSTOM; do
if [[ -e "${_bash_it_config_file}" ]]; then
filename=$(basename "${_bash_it_config_file}")
filename=${filename%*.bash}
BASH_IT_LOG_PREFIX="custom: $filename: "
@ -124,23 +118,22 @@ fi
# Adding Support for other OSes
PREVIEW="less"
if [ -s /usr/bin/gloobus-preview ]; then
if [[ -s /usr/bin/gloobus-preview ]]; then
PREVIEW="gloobus-preview"
elif [ -s /Applications/Preview.app ]; then
elif [[ -s /Applications/Preview.app ]]; then
# shellcheck disable=SC2034
PREVIEW="/Applications/Preview.app"
fi
# Load all the Jekyll stuff
if [ -e "$HOME/.jekyllconfig" ]
then
if [[ -e "$HOME/.jekyllconfig" ]]; then
# shellcheck disable=SC1090
. "$HOME/.jekyllconfig"
source "$HOME/.jekyllconfig"
fi
# 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
darwin*)
alias reload='source ~/.bash_profile'

View File

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