mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-07-01 21:00:29 +08:00
add unknown command "version". available: update, force-update, reset, cd and replace tabs with spaces
This commit is contained in:
parent
61b7d11977
commit
2fb1cd6599
73
.zshrc2
73
.zshrc2
@ -20,23 +20,23 @@ ANTIGEN_URL="https://gitee.com/dictxiong/antigen/raw/develop/bin/antigen.zsh"
|
|||||||
ANTIGEN="$HOME/antigen.zsh"
|
ANTIGEN="$HOME/antigen.zsh"
|
||||||
# Install antigen.zsh if not exist
|
# Install antigen.zsh if not exist
|
||||||
if [ ! -f "$ANTIGEN" ]; then
|
if [ ! -f "$ANTIGEN" ]; then
|
||||||
echo "Installing antigen ..."
|
echo "Installing antigen ..."
|
||||||
TMPFILE="/tmp/antigen.zsh"
|
TMPFILE="/tmp/antigen.zsh"
|
||||||
if [ -x "$(which curl)" ]; then
|
if [ -x "$(which curl)" ]; then
|
||||||
curl -L "$ANTIGEN_URL" -o "$TMPFILE"
|
curl -L "$ANTIGEN_URL" -o "$TMPFILE"
|
||||||
elif [ -x "$(which wget)" ]; then
|
elif [ -x "$(which wget)" ]; then
|
||||||
wget "$ANTIGEN_URL" -O "$TMPFILE"
|
wget "$ANTIGEN_URL" -O "$TMPFILE"
|
||||||
else
|
else
|
||||||
echo "ERROR: please install curl or wget before installation !!"
|
echo "ERROR: please install curl or wget before installation !!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [ ! $? -eq 0 ]; then
|
if [ ! $? -eq 0 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "ERROR: downloading antigen.zsh ($ANTIGEN_URL) failed !!"
|
echo "ERROR: downloading antigen.zsh ($ANTIGEN_URL) failed !!"
|
||||||
exit
|
exit
|
||||||
fi;
|
fi;
|
||||||
echo "move $TMPFILE to $ANTIGEN"
|
echo "move $TMPFILE to $ANTIGEN"
|
||||||
mv "$TMPFILE" "$ANTIGEN"
|
mv "$TMPFILE" "$ANTIGEN"
|
||||||
fi
|
fi
|
||||||
# config and enable antigen
|
# config and enable antigen
|
||||||
source "$ANTIGEN"
|
source "$ANTIGEN"
|
||||||
@ -79,29 +79,30 @@ fi
|
|||||||
|
|
||||||
dfs()
|
dfs()
|
||||||
{
|
{
|
||||||
case $1 in
|
case $1 in
|
||||||
update ) $DOTFILES/update.sh ;;
|
update ) $DOTFILES/update.sh ;;
|
||||||
force-update ) (cd "$DOTFILES" && git fetch --all && git reset --hard origin/main && git pull) ;;
|
force-update ) (cd "$DOTFILES" && git fetch --all && git reset --hard origin/main && git pull) ;;
|
||||||
reset )
|
version ) (cd "$DOTFILES" && git rev-parse HEAD) ;;
|
||||||
antigen reset 1> /dev/null
|
reset )
|
||||||
rm -rf $HOME/.antigen
|
antigen reset 1> /dev/null
|
||||||
$DOTFILES/install.sh -r
|
rm -rf $HOME/.antigen
|
||||||
dfs update
|
$DOTFILES/install.sh -r
|
||||||
$DOTFILES/install.sh -i
|
dfs update
|
||||||
echo 'Done. Please open a new shell to see the changes.'
|
$DOTFILES/install.sh -i
|
||||||
;;
|
echo 'Done. Please open a new shell to see the changes.'
|
||||||
cd ) cd "$DOTFILES" ;;
|
;;
|
||||||
* ) echo "unknown command \"$1\". available: update, force-update, reset, cd" ;;
|
cd ) cd "$DOTFILES" ;;
|
||||||
esac
|
* ) echo "unknown command \"$1\". available: update, force-update, reset, cd" ;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
dogo()
|
dogo()
|
||||||
{
|
{
|
||||||
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
||||||
echo "usage: dogo <container>"
|
echo "usage: dogo <container>"
|
||||||
else
|
else
|
||||||
$SUDO docker exec -it $1 zsh
|
$SUDO docker exec -it $1 zsh
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# alias
|
# alias
|
||||||
|
Loading…
x
Reference in New Issue
Block a user