Add $ENABLED_DIR and move $DOTFILES
This commit is contained in:
parent
efa692a819
commit
b8aeeccc86
|
@ -19,8 +19,7 @@
|
||||||
# -n Don't overwrite conflicts (no prompts
|
# -n Don't overwrite conflicts (no prompts
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
DOTFILES=$(cd $(dirname $0) && pwd -P)
|
source "$(cd $(dirname $0) && pwd -P)/shell/common.sh"
|
||||||
source "$DOTFILES/shell/common.sh"
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -88,7 +87,7 @@ shift $((OPTIND-1))
|
||||||
#
|
#
|
||||||
[[ -d ~/.bin ]] || _run mkdir -p ~/.bin
|
[[ -d ~/.bin ]] || _run mkdir -p ~/.bin
|
||||||
PATH="$DOTFILES/.bin:$PATH"
|
PATH="$DOTFILES/.bin:$PATH"
|
||||||
for topic in ${@:-$(find "$DOTFILES/.enabled.d" -maxdepth 1 -type l)}; do
|
for topic in ${@:-$(find "$ENABLED_DIR" -maxdepth 1 -type l)}; do
|
||||||
[[ -d $topic ]] || continue
|
[[ -d $topic ]] || continue
|
||||||
|
|
||||||
tpath=$(realpath "$topic")
|
tpath=$(realpath "$topic")
|
||||||
|
@ -100,11 +99,11 @@ for topic in ${@:-$(find "$DOTFILES/.enabled.d" -maxdepth 1 -type l)}; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Link topic to .enabled.d
|
# Link topic to .enabled.d
|
||||||
if [[ -h "$DOTFILES/.enabled.d/$tname" ]]; then
|
if [[ -h "$ENABLED_DIR/$tname" ]]; then
|
||||||
[[ "$update" && -x $tpath/update ]] && _run "$tpath/update"
|
[[ "$update" && -x $tpath/update ]] && _run "$tpath/update"
|
||||||
else
|
else
|
||||||
# Register topic as 'enabled'
|
# Register topic as 'enabled'
|
||||||
_run ln -svf "$tpath" "$DOTFILES/.enabled.d/$tname"
|
_run ln -svf "$tpath" "$ENABLED_DIR/$tname"
|
||||||
|
|
||||||
# Run install script
|
# Run install script
|
||||||
[[ "$install" && -x $tpath/install ]] && _run "$tpath/install"
|
[[ "$install" && -x $tpath/install ]] && _run "$tpath/install"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
CACHE_DIR="$DOTFILES/shell/zsh/cache"
|
DOTFILES="$HOME/.dotfiles"
|
||||||
|
CACHE_DIR="$HOME/.cache/${ZSH_NAME:-sh}"
|
||||||
|
ENABLED_DIR="$DOTFILES/.enabled.d"
|
||||||
|
|
||||||
is-callable() { command -v "$1" >/dev/null; }
|
is-callable() { command -v "$1" >/dev/null; }
|
||||||
is-interactive() { [[ $- == *i* ]]; }
|
is-interactive() { [[ $- == *i* ]]; }
|
||||||
|
@ -23,8 +25,8 @@ cache() {
|
||||||
[[ -d "$CACHE_DIR" ]] || mkdir -p "$CACHE_DIR"
|
[[ -d "$CACHE_DIR" ]] || mkdir -p "$CACHE_DIR"
|
||||||
|
|
||||||
is-callable "$1" || return 1
|
is-callable "$1" || return 1
|
||||||
local cache="${CACHE_DIR}/$1-$(basename $SHELL)"
|
local cache="${CACHE_DIR}/$1-${SHELL##*/}"
|
||||||
if [[ ! -f "$cache" && -s "$cache" ]]; then
|
if [[ ! -f "$cache" || ! -s "$cache" ]]; then
|
||||||
echo "Caching $1"
|
echo "Caching $1"
|
||||||
$@ > "$cache" 2> /dev/null
|
$@ > "$cache" 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue