From 7a7526d184981c430dd538964bc513b19fac49d8 Mon Sep 17 00:00:00 2001 From: Dict Xiong Date: Sat, 14 May 2022 20:26:25 +0800 Subject: [PATCH] Dev (#1) * more robost dotfile_path * add 'dfs' 'pls' and 'se' * debug --- .zshrc2 | 17 ++++++++++++++++- install.sh | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.zshrc2 b/.zshrc2 index 1f4fd0e..1102624 100644 --- a/.zshrc2 +++ b/.zshrc2 @@ -58,4 +58,19 @@ antigen bundle https://gitee.com/dictxiong/zsh-autosuggestions antigen theme ys # apply antigen apply -# end of antigen config \ No newline at end of file +# end of antigen config + +# functions +export DOTFILES=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) +dfs() +{ + if [[ $1 == update ]]; then + (cd "$DOTFILES" && env git pull) + else + echo "unknown command \"$1\". available: update" + fi +} + +# alias +alias "pls"='sudo $(fc -ln -1)' +alias "se"='sudo -sE' \ No newline at end of file diff --git a/install.sh b/install.sh index 2161283..0ab7688 100755 --- a/install.sh +++ b/install.sh @@ -89,7 +89,7 @@ setup_color() { } # END of color settings -dotfile_path=$(cd $(dirname $0); pwd) +dotfile_path=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd ) home_slashes=${HOME//\//\\\/} if [[ ! $dotfile_path == ${home_slashes}* ]]; then fmt_fatal "\"$dotfile_path\" is not under \"$HOME\". aborting ..."