zshrc: dfs config

This commit is contained in:
Dict Xiong 2022-11-17 22:20:07 +08:00
parent bd4e11dad5
commit 59a1dda958
2 changed files with 8 additions and 4 deletions

View File

@ -142,7 +142,13 @@ bindkey "\ed" delete-char # alt+d
dfs()
{
case $1 in
cd ) cd "$DOTFILES" ;;
update ) "$DOTFILES/update.sh" ;;
version ) (cd "$DOTFILES" && git rev-parse HEAD) ;;
config )
mkdir -p ~/.config/dotfiles
$EDITOR ~/.config/dotfiles/env
;;
force-update ) (
cd "$DOTFILES"
git fetch --all
@ -150,7 +156,6 @@ dfs()
for i in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${i#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
@ -159,7 +164,6 @@ dfs()
"$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

View File

@ -67,8 +67,8 @@ install_dependencies()
preinstall_check()
{
fmt_note "checking requirements ..."
mandatory_commands=( "git" "zsh" "curl" "ping" )
optional_commands=( "python3" "vim" "tmux" )
local mandatory_commands=( "git" "zsh" "curl" )
local optional_commands=( "python3" "vim" "tmux" "ping" )
for i in "${mandatory_commands[@]}"; do
if [[ ! -x "$(command -v $i)" ]]; then
fmt_info "all this utils are required: ${mandatory_commands[@]}"