diff --git a/core/help.sh b/core/help.sh index 3ff6ca7..9a51e96 100644 --- a/core/help.sh +++ b/core/help.sh @@ -52,8 +52,10 @@ function show_main_help() { function show_modules() { for module_file in "${AK_ROOT}/modules/"*.sh; do if [[ -f "$module_file" ]]; then - local category=$(grep -m 1 "# CATEGORY:" "$module_file" | sed 's/# CATEGORY: //') - local module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') + local category + category=$(grep -m 1 "# CATEGORY:" "$module_file" | sed 's/# CATEGORY: //') + local module_name + module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') printf " %-15s - %s\n" "$module_name" "${category:-Uncategorized}" fi done @@ -64,10 +66,12 @@ function show_module_help() { local found=0 for module_file in "${AK_ROOT}/modules/"*.sh; do - local module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') + local module_name + module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') if [[ "$module_name" == "$target_module" ]]; then found=1 - local category=$(grep -m 1 "# CATEGORY:" "$module_file" | sed 's/# CATEGORY: //') + local category + category=$(grep -m 1 "# CATEGORY:" "$module_file" | sed 's/# CATEGORY: //') print_color "cyan" "📦 Module: $module_name ($category)" echo "---------------------------------------------------" @@ -113,10 +117,12 @@ function search_aliases() { local found=0 for module_file in "${AK_ROOT}/modules/"*.sh; do - local module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') + local module_name + module_name=$(basename "$module_file" | sed -E 's/^[0-9]+_//' | sed 's/\.sh$//') # We need to extract blocks of alias info. - local results=$(awk -v term="$term" ' + local results + results=$(awk -v term="$term" ' /^## / { cmd = substr($0, 4) getline @@ -167,6 +173,7 @@ case "$COMMAND" in show_modules ;; reload) + # shellcheck source=/dev/null source ~/.bashrc print_color "green" "✔ Aliaskit reloaded directly." ;; diff --git a/core/init.sh b/core/init.sh index c11ef81..fe34002 100644 --- a/core/init.sh +++ b/core/init.sh @@ -2,7 +2,8 @@ # core/init.sh - Initializes aliaskit, loads configs, and sources enabled modules -export AK_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +AK_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +export AK_ROOT export AK_CONFIG="${HOME}/.aliaskit.conf" # Copy default config if it doesn't exist @@ -15,6 +16,7 @@ fi # Load configs if [[ -f "$AK_CONFIG" ]]; then + # shellcheck source=/dev/null source "$AK_CONFIG" fi @@ -26,6 +28,7 @@ for module_file in "${AK_ROOT}/modules/"*.sh; do # Check if module is enabled (defaults to true if not explicitly set to false) if [[ "${!var_name}" != "false" ]]; then + # shellcheck source=/dev/null source "$module_file" fi fi diff --git a/update.sh b/update.sh index 1a343de..eeaaf47 100755 --- a/update.sh +++ b/update.sh @@ -15,8 +15,10 @@ check_and_update() { # We will do a quick check against remote git fetch origin main &>/dev/null || git fetch origin master &>/dev/null - local LOCAL=$(git rev-parse HEAD 2>/dev/null) - local REMOTE=$(git rev-parse @{u} 2>/dev/null) + local LOCAL + LOCAL=$(git rev-parse HEAD 2>/dev/null) + local REMOTE + REMOTE=$(git rev-parse "@{u}" 2>/dev/null) if [[ -z "$LOCAL" || -z "$REMOTE" ]]; then [[ $AUTO_MODE -eq 0 ]] && echo "Cannot check for updates. Are you in a git repository with an upstream set?"