mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-04-25 07:26:52 +08:00
29 lines
1.1 KiB
Bash
Executable File
29 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
|
DOTFILES=${DOTFILES:-$( cd "$THIS_DIR/.." && pwd )}
|
|
source "$DOTFILES/tools/common.sh"
|
|
|
|
case $1 in
|
|
update ) "$DOTFILES/update.sh" ;;
|
|
force-update ) (
|
|
cd "$DOTFILES"
|
|
git fetch --all
|
|
ref=$(git symbolic-ref --short HEAD 2> /dev/null) || ref=$(git rev-parse --short HEAD 2> /dev/null) || return 0
|
|
for b in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${b#refs/heads/} ; git pull --ff-only ; done
|
|
git checkout -c advice.detachedHead=false $ref)
|
|
;;
|
|
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" ;;
|
|
log ) "$DOTFILES/tools/post-log.py" "$2" ;;
|
|
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
|
esac
|