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
|
||||
|
||||
set -e
|
||||
DOTFILES=$(cd $(dirname $0) && pwd -P)
|
||||
source "$DOTFILES/shell/common.sh"
|
||||
source "$(cd $(dirname $0) && pwd -P)/shell/common.sh"
|
||||
shopt -s nullglob
|
||||
|
||||
#
|
||||
|
@ -88,7 +87,7 @@ shift $((OPTIND-1))
|
|||
#
|
||||
[[ -d ~/.bin ]] || _run mkdir -p ~/.bin
|
||||
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
|
||||
|
||||
tpath=$(realpath "$topic")
|
||||
|
@ -100,11 +99,11 @@ for topic in ${@:-$(find "$DOTFILES/.enabled.d" -maxdepth 1 -type l)}; do
|
|||
done
|
||||
|
||||
# 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"
|
||||
else
|
||||
# Register topic as 'enabled'
|
||||
_run ln -svf "$tpath" "$DOTFILES/.enabled.d/$tname"
|
||||
_run ln -svf "$tpath" "$ENABLED_DIR/$tname"
|
||||
|
||||
# Run install script
|
||||
[[ "$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-interactive() { [[ $- == *i* ]]; }
|
||||
|
@ -23,8 +25,8 @@ cache() {
|
|||
[[ -d "$CACHE_DIR" ]] || mkdir -p "$CACHE_DIR"
|
||||
|
||||
is-callable "$1" || return 1
|
||||
local cache="${CACHE_DIR}/$1-$(basename $SHELL)"
|
||||
if [[ ! -f "$cache" && -s "$cache" ]]; then
|
||||
local cache="${CACHE_DIR}/$1-${SHELL##*/}"
|
||||
if [[ ! -f "$cache" || ! -s "$cache" ]]; then
|
||||
echo "Caching $1"
|
||||
$@ > "$cache" 2> /dev/null
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue