Loading improvements

.bashrc will skip .swp files (editors leave those while open)
bin.path renamed to path.env and PATH manipulation should be 'cleaner'
  it adds required dirs to paths, but also makes sure no duplicates are
  inserted.
chezmoi logic split, and status is seperated from aliases.
Disable chezmoi status on load, as it is SLOW.
This commit is contained in:
Lockszmith 2022-05-29 05:33:04 +00:00
parent ce4d8c303d
commit 7c17b8922c
6 changed files with 24 additions and 14 deletions

View File

@ -13,7 +13,7 @@ if [ -d ~/.sz.shrc.d ]; then
script_source+=("$(find ~/.sz.shrc.d -maxdepth 0 -type d)") script_source+=("$(find ~/.sz.shrc.d -maxdepth 0 -type d)")
script_source+=("$(find ~/.sz.shrc.d -maxdepth 1 -type d -name "$(ps -p$$ -ho comm).post")") script_source+=("$(find ~/.sz.shrc.d -maxdepth 1 -type d -name "$(ps -p$$ -ho comm).post")")
for script_src in ${script_source[@]}; do for script_src in ${script_source[@]}; do
scripts=$(find $script_src -maxdepth 1 -type f -not -name "*.off" | sort) scripts=$(find $script_src -maxdepth 1 -type f -not -name "*.off" -not -name "*.swp" | sort)
for script_name in $scripts; do for script_name in $scripts; do
if [ -r $script_name ]; then if [ -r $script_name ]; then
[ -z ${DBG_SZSHRC} ] || echo "Sourcing $script_name..." [ -z ${DBG_SZSHRC} ] || echo "Sourcing $script_name..."

View File

@ -1,9 +0,0 @@
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/bin" ]] ; then
export PATH="~/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/.local/bin" ]] ; then
export PATH="~/.local/bin:$PATH"
fi

View File

@ -0,0 +1,18 @@
get_clean_path() {
sed 's/ *:\?$//g;s/`/``/g;s/:/`:`/g;s/\\`:`/\\:/g;' <<< $1 | \
awk -v RS='`:`' -v ORS='`:`' '!arr[$0]++' | \
sed 's/`:`/:/g;s/:$//g'
}
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/bin" ]] ; then
export PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [[ -d "$HOME/.local/bin" ]] ; then
export PATH="$HOME/.local/bin:$PATH"
fi
PATH=$( get_clean_path $PATH )

View File

@ -12,8 +12,4 @@ if [[ -n "$(type -fP chezmoi)" ]]; then
chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|git@github.com:|https://github.com/|')" chezmoi git -- remote set-url origin "$(chezmoi git -- remote get-url origin | sed 's|git@github.com:|https://github.com/|')"
chezmoi git -- remote get-url origin chezmoi git -- remote get-url origin
} }
CHEZMOI_OUT="$(chezmoi status || true)x"
[[ "x" != "$CHEZMOI_OUT" ]] && printf "\nChezmoi changes:\n" && echo "${CHEZMOI_OUT%?}"
unset CHEZMOI_OUT
fi fi

View File

@ -0,0 +1,5 @@
if [[ -n "$(type -fP chezmoi)" ]]; then
CHEZMOI_OUT="$(chezmoi status || true)x"
[[ "x" != "$CHEZMOI_OUT" ]] && printf "\nChezmoi changes:\n" && echo "${CHEZMOI_OUT%?}"
unset CHEZMOI_OUT
fi