A minimal zsh plugin manager.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
921 B

#!/bin/sh
main() {
local ROCKDIR="$HOME/.local/share/rock"
local ZSHRC="$HOME/.zshrc"
local CMD='[[ -f "$HOME/.local/share/rock/rock.zsh" ]] && source "$HOME/.local/share/rock/rock.zsh"'
git clone https://git.lucasf.dev/public/rock "$ROCKDIR" > /dev/null 2>&1
if [[ ! -d "$ROCKDIR/plugins" ]]; then
mkdir -p "$ROCKDIR/plugins"
fi
if [[ -n "$ZDOTDIR" ]] && [[ -f "$ZDOTDIR/.zshrc" ]]; then
ZSHRC="$ZDOTDIR/.zshrc"
fi
if [[ ! -f $ZSHRC || $(cat $ZSHRC | wc -l) = 0 ]];then
echo $CMD > $ZSHRC
else
if ! grep -q '[[ -f "$HOME/.local/share/rock/rock.zsh" ]] && source "$HOME/.local/share/rock/rock.zsh"' $ZSHRC; then
sed -i '1 i[[ -f "$HOME/.local/share/rock/rock.zsh" ]] && source "$HOME/.local/share/rock/rock.zsh"' $ZSHRC
fi
fi
}
main
if [[ $? -eq 0 ]];then echo "🎸 You Rock Yeah!! 🤘"; fi
# vim: ft=zsh:ts=4:sts=4:sw=4