mirror of
https://github.com/DictXiong/dotfiles.git
synced 2024-11-24 15:57:00 +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 }
|
sibd() { ssh -p 12022 root@$1${1:+.}ibd.ink }
|
||||||
sob() { ssh -p 24022 root@$1${1:+.}ob.ac.cn }
|
sob() { ssh -p 24022 root@$1${1:+.}ob.ac.cn }
|
||||||
snasp() { ssh -o ProxyJump="ssh@nasp.ob.ac.cn:36022" dictxiong@$1 }
|
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()
|
piv-agent()
|
||||||
{
|
{
|
||||||
eval $(ssh-agent -k)
|
eval $(ssh-agent -k)
|
||||||
|
|
|
@ -258,7 +258,7 @@ uninstall(){
|
||||||
|
|
||||||
parse_arg "$@"
|
parse_arg "$@"
|
||||||
FUNC=install
|
FUNC=install
|
||||||
for i in ${ARG_PARSED[@]}; do
|
for i in ${PARSE_ARG_RET[@]}; do
|
||||||
case $i in
|
case $i in
|
||||||
-i ) FUNC=install ;;
|
-i ) FUNC=install ;;
|
||||||
-r ) FUNC=uninstall ;;
|
-r ) FUNC=uninstall ;;
|
||||||
|
|
|
@ -105,14 +105,14 @@ fi
|
||||||
parse_arg()
|
parse_arg()
|
||||||
{
|
{
|
||||||
local ARG=""
|
local ARG=""
|
||||||
ARG_PARSED=()
|
PARSE_ARG_RET=()
|
||||||
while [[ $# > 0 || -n "$ARG" ]]; do
|
while [[ $# > 0 || -n "$ARG" ]]; do
|
||||||
if [[ -z "$ARG" ]]; then ARG=$1; shift; fi
|
if [[ -z "$ARG" ]]; then ARG=$1; shift; fi
|
||||||
case $ARG in
|
case $ARG in
|
||||||
-q*|--quite ) export DFS_QUIET=1 ;;
|
-q*|--quite ) DFS_QUIET=1 ;;
|
||||||
--* ) ARG_PARSED+=("$ARG") ;;
|
--* ) PARSE_ARG_RET+=("$ARG") ;;
|
||||||
-* ) ARG_PARSED+=("${ARG:0:2}") ;;
|
-* ) PARSE_ARG_RET+=("${ARG:0:2}") ;;
|
||||||
* ) ARG_PARSED+=("$ARG") ;;
|
* ) PARSE_ARG_RET+=("$ARG") ;;
|
||||||
esac
|
esac
|
||||||
if [[ "$ARG" == "--"* || ! "$ARG" == "-"* || ${#ARG} -le 2 ]]; then
|
if [[ "$ARG" == "--"* || ! "$ARG" == "-"* || ${#ARG} -le 2 ]]; then
|
||||||
ARG=""
|
ARG=""
|
||||||
|
@ -191,3 +191,5 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||||
else
|
else
|
||||||
setup_color
|
setup_color
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset THIS_DIR_COMMON_SH
|
||||||
|
|
Loading…
Reference in New Issue
Block a user