.fast-run-git-command: Support for --status option

This commit is contained in:
Sebastian Gniazdowski
2020-02-16 21:58:42 +01:00
parent 274012fd84
commit a12906ca5e
+14 -1
View File
@@ -26,11 +26,24 @@
typeset -ga __lines_list
local -a __response
if [[ $1 == --status ]] {
integer __status=1
shift
}
if [[ -z ${FAST_HIGHLIGHT[$2-cache]} || $(( EPOCHSECONDS - FAST_HIGHLIGHT[$2-cache-born-at] )) -gt ${4:-5} ]]; then
FAST_HIGHLIGHT[$2-cache-born-at]=$EPOCHSECONDS
if [[ "$(command git rev-parse --is-inside-work-tree 2>/dev/null)" = true ]]; then
__response=( ${${(f)"$(command ${(Qz)${1#+}} 2>/dev/null)"}#$3} )
[[ "$1" = "+"* ]] && __lines_list+=( "${__response[@]}" ) || __lines_list=( "${__response[@]}" )
integer retval=$?
if (( __status )) {
__response=( $retval )
__lines_list=( $retval )
} else {
[[ "$1" = "+"* ]] && \
__lines_list+=( "${__response[@]}" ) || \
__lines_list=( "${__response[@]}" )
}
else
__lines_list=()
fi