mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-04-24 07:36:53 +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"
|
||||
# Install antigen.zsh if not exist
|
||||
if [ ! -f "$ANTIGEN" ]; then
|
||||
echo "Installing antigen ..."
|
||||
TMPFILE="/tmp/antigen.zsh"
|
||||
if [ -x "$(which curl)" ]; then
|
||||
curl -L "$ANTIGEN_URL" -o "$TMPFILE"
|
||||
elif [ -x "$(which wget)" ]; then
|
||||
wget "$ANTIGEN_URL" -O "$TMPFILE"
|
||||
else
|
||||
echo "ERROR: please install curl or wget before installation !!"
|
||||
exit
|
||||
fi
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "ERROR: downloading antigen.zsh ($ANTIGEN_URL) failed !!"
|
||||
exit
|
||||
fi;
|
||||
echo "move $TMPFILE to $ANTIGEN"
|
||||
mv "$TMPFILE" "$ANTIGEN"
|
||||
echo "Installing antigen ..."
|
||||
TMPFILE="/tmp/antigen.zsh"
|
||||
if [ -x "$(which curl)" ]; then
|
||||
curl -L "$ANTIGEN_URL" -o "$TMPFILE"
|
||||
elif [ -x "$(which wget)" ]; then
|
||||
wget "$ANTIGEN_URL" -O "$TMPFILE"
|
||||
else
|
||||
echo "ERROR: please install curl or wget before installation !!"
|
||||
exit
|
||||
fi
|
||||
if [ ! $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "ERROR: downloading antigen.zsh ($ANTIGEN_URL) failed !!"
|
||||
exit
|
||||
fi;
|
||||
echo "move $TMPFILE to $ANTIGEN"
|
||||
mv "$TMPFILE" "$ANTIGEN"
|
||||
fi
|
||||
# config and enable antigen
|
||||
source "$ANTIGEN"
|
||||
|
@ -79,29 +79,30 @@ fi
|
|||
|
||||
dfs()
|
||||
{
|
||||
case $1 in
|
||||
update ) $DOTFILES/update.sh ;;
|
||||
force-update ) (cd "$DOTFILES" && git fetch --all && git reset --hard origin/main && git pull) ;;
|
||||
reset )
|
||||
antigen reset 1> /dev/null
|
||||
rm -rf $HOME/.antigen
|
||||
$DOTFILES/install.sh -r
|
||||
dfs update
|
||||
$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" ;;
|
||||
esac
|
||||
case $1 in
|
||||
update ) $DOTFILES/update.sh ;;
|
||||
force-update ) (cd "$DOTFILES" && git fetch --all && git reset --hard origin/main && git pull) ;;
|
||||
version ) (cd "$DOTFILES" && git rev-parse HEAD) ;;
|
||||
reset )
|
||||
antigen reset 1> /dev/null
|
||||
rm -rf $HOME/.antigen
|
||||
$DOTFILES/install.sh -r
|
||||
dfs update
|
||||
$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" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
dogo()
|
||||
{
|
||||
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
||||
echo "usage: dogo <container>"
|
||||
else
|
||||
$SUDO docker exec -it $1 zsh
|
||||
fi
|
||||
if [[ -z "$1" || "$1" =~ "-h|--help" ]]; then
|
||||
echo "usage: dogo <container>"
|
||||
else
|
||||
$SUDO docker exec -it $1 zsh
|
||||
fi
|
||||
}
|
||||
|
||||
# alias
|
||||
|
|
Loading…
Reference in New Issue
Block a user