mirror of
https://github.com/zdharma-continuum/fast-syntax-highlighting.git
synced 2026-08-12 22:31:28 +04:00
.fast-run-git-command: Support for --status option
This commit is contained in:
+14
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user