mirror of
https://github.com/DictXiong/dotfiles.git
synced 2025-12-19 12:37:49 +08:00
bug fix
This commit is contained in:
parent
a68a9af330
commit
8be06f7d97
27
.zshrc2
27
.zshrc2
@ -92,3 +92,30 @@ bindkey "^[[1~" beginning-of-line
|
|||||||
bindkey "^[[4~" end-of-line
|
bindkey "^[[4~" end-of-line
|
||||||
bindkey "^[OH" beginning-of-line
|
bindkey "^[OH" beginning-of-line
|
||||||
bindkey "^[OF" end-of-line
|
bindkey "^[OF" end-of-line
|
||||||
|
|
||||||
|
# dfs
|
||||||
|
dfs()
|
||||||
|
{
|
||||||
|
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/common.sh" "post_log" "INFO" "dfs" "$2" ;;
|
||||||
|
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|||||||
28
scripts/dfs
28
scripts/dfs
@ -1,28 +0,0 @@
|
|||||||
#!/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 ) post_log "INFO" "dfs" "$2" ;;
|
|
||||||
* ) echo "unknown command \"$1\". available: update, force-update, version, reset, cd, log" ;;
|
|
||||||
esac
|
|
||||||
2
tools/common.sh
Normal file → Executable file
2
tools/common.sh
Normal file → Executable file
@ -151,7 +151,7 @@ get_linux_dist() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
$1
|
$1 "${@:2}"
|
||||||
else
|
else
|
||||||
setup_color
|
setup_color
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user