fix(shell): rework shell config for more stability

This commit is contained in:
2023-10-02 08:39:07 +03:00
parent a73c54a5a6
commit e6f3aae287
16 changed files with 294 additions and 226 deletions

View File

@@ -9,7 +9,6 @@
# Helper variables, override with ENVs like `VERBOSE=1 dfm help`
: "${VERBOSE:=0}"
: "${DOTFILES:=$HOME/.dotfiles}"
: "${SHARED_SCRIPT:=$DOTFILES/scripts/shared.sh}"
: "${BREWFILE:=$DOTFILES/config/homebrew/Brewfile}"
: "${HOSTFILES:=$DOTFILES/hosts}"
@@ -17,9 +16,9 @@ SCRIPT=$(basename "$0")
VERSION_NVM="v0.39.5"
export DOTFILES_SHARED_LOADED=""
export DOTFILES="$HOME/.dotfiles"
# shellcheck source=./../../scripts/shared.sh
source "$SHARED_SCRIPT"
source "$HOME/.dotfiles/scripts/shared.sh"
# Loads configs for better installation experience
x-load-configs

16
local/bin/x-dc Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# Create directory if it doesn't exist already
#
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
# Licensed under MIT License. http://www.opensource.org/licenses/mit-license.
dir="$1"
[ $# -eq 0 ] && {
echo "Usage: $0 full/path/to/dir/to/create"
exit 1
}
if [ ! -d "$dir" ]; then
mkdir -p "$dir" && exit 0
fi

View File

@@ -2,13 +2,13 @@
# Load our configuration files
# Copyright (c) 2023 Ismo Vuorinen. All Rights Reserved.
: "${DOTFILES:=$HOME/.dotfiles}"
source "$DOTFILES/scripts/shared.sh"
DOTFILES="$HOME/.dotfiles"
source "$HOME/.dotfiles/scripts/shared.sh"
CONFIG_PATH="$DOTFILES/config"
# Load the shell dotfiles, and then some:
function load()
function x-load-config-fn()
{
for FILE in $CONFIG_PATH/{exports,alias,functions}; do
FILENAME="$FILE"
@@ -28,4 +28,4 @@ function load()
done
}
load
x-load-config-fn