mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 13:27:01 +08:00
improve gbes; PARSE_ARG_RET
This commit is contained in:
parent
e95509208e
commit
eabd6ac1aa
2
.zshrc2
2
.zshrc2
|
@ -95,7 +95,7 @@ esac
|
|||
sibd() { ssh -p 12022 root@$1${1:+.}ibd.ink }
|
||||
sob() { ssh -p 24022 root@$1${1:+.}ob.ac.cn }
|
||||
snasp() { ssh -o ProxyJump="ssh@nasp.ob.ac.cn:36022" dictxiong@$1 }
|
||||
git-branches() { git for-each-ref --sort=-committerdate refs/heads refs/remotes --format="%(authordate:format:%y-%m-%d.%a %H:%M %z)|%(color:red)%(objectname:short)|%(color:yellow)%(refname:short)%(color:reset)|%(color:reset)%(authorname): %(color:green)%(subject)" --color=always --count=${1:-10} | column -ts"|" }
|
||||
gbes() { git for-each-ref --sort=-committerdate refs/heads refs/remotes --format="%(authordate:format:%y-%m-%d.%a %H:%M %z)|%(color:red)%(objectname:short)|%(color:yellow)%(refname:short)%(color:reset)|%(color:reset)%(authorname): %(color:green)%(subject)" --color=always | column -ts"|" | less -FX }
|
||||
piv-agent()
|
||||
{
|
||||
eval $(ssh-agent -k)
|
||||
|
|
|
@ -258,7 +258,7 @@ uninstall(){
|
|||
|
||||
parse_arg "$@"
|
||||
FUNC=install
|
||||
for i in ${ARG_PARSED[@]}; do
|
||||
for i in ${PARSE_ARG_RET[@]}; do
|
||||
case $i in
|
||||
-i ) FUNC=install ;;
|
||||
-r ) FUNC=uninstall ;;
|
||||
|
|
|
@ -105,14 +105,14 @@ fi
|
|||
parse_arg()
|
||||
{
|
||||
local ARG=""
|
||||
ARG_PARSED=()
|
||||
PARSE_ARG_RET=()
|
||||
while [[ $# > 0 || -n "$ARG" ]]; do
|
||||
if [[ -z "$ARG" ]]; then ARG=$1; shift; fi
|
||||
case $ARG in
|
||||
-q*|--quite ) export DFS_QUIET=1 ;;
|
||||
--* ) ARG_PARSED+=("$ARG") ;;
|
||||
-* ) ARG_PARSED+=("${ARG:0:2}") ;;
|
||||
* ) ARG_PARSED+=("$ARG") ;;
|
||||
-q*|--quite ) DFS_QUIET=1 ;;
|
||||
--* ) PARSE_ARG_RET+=("$ARG") ;;
|
||||
-* ) PARSE_ARG_RET+=("${ARG:0:2}") ;;
|
||||
* ) PARSE_ARG_RET+=("$ARG") ;;
|
||||
esac
|
||||
if [[ "$ARG" == "--"* || ! "$ARG" == "-"* || ${#ARG} -le 2 ]]; then
|
||||
ARG=""
|
||||
|
@ -191,3 +191,5 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|||
else
|
||||
setup_color
|
||||
fi
|
||||
|
||||
unset THIS_DIR_COMMON_SH
|
||||
|
|
Loading…
Reference in New Issue
Block a user