From b750c37e3be80df57d1005e3a70f28056c4deead Mon Sep 17 00:00:00 2001 From: wsq Date: Tue, 6 Aug 2019 20:05:58 +0800 Subject: [PATCH] gcn demo --- zsh/functions.zsh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/zsh/functions.zsh b/zsh/functions.zsh index 254c008..00f8007 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -181,13 +181,12 @@ function qshell_upload() { } function gitr() { - args=$* for dir in `ls`; do if [[ -d "$dir" && -d "$dir/.git" ]]; then pushd . echo "${GREEN}$(basename $dir)${NC}" cd $dir - git $args + git $* popd fi done @@ -355,3 +354,29 @@ function dc { function get_ip_of_ssh_hostname { ssh -G $1 | awk '/^hostname / { print $2 }' } +function gcn { + while true;do + typeset -A users + users=('1' 'hophacker' '2' 'zhcalvin' '6' 'wsq') + for k in "${(@k)users}"; do + echo "$k || $users[$k]" + done + read input + if [[ ! -z $users[$input] ]];then + name=$users[$input] + break + else + for k in "${(@k)users}"; do + if [[ $input == $users[$k] ]];then + name=$input + break 2 + fi + done + echo 'invalid option...' + fi + done + typeset -A emails + emails=('hophacker' 'j' 'zhcalvin' 'c' 'wsq' 'wsq') + set -x + git commit --amend --author="$name<$emails[$name]@paiyou.co>" $* +}