From 59a1dda9586f88335368c5004ac47d296f12f12a Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Thu, 17 Nov 2022 22:20:07 +0800 Subject: [PATCH] zshrc: dfs config --- .zshrc2 | 8 ++++++-- install.sh | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.zshrc2 b/.zshrc2 index 63dc6a3..d8d9b42 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -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 diff --git a/install.sh b/install.sh index 1cef6c0..978600c 100755 --- a/install.sh +++ b/install.sh @@ -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[@]}"