From 9ebbd27361ababb8c5423c52de3d0ce9c160918a Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Mon, 10 Aug 2026 09:35:00 +0900 Subject: [PATCH] Declare match, mbegin, mend arrays when using regexp --- src/_chromium | 3 ++- src/_cmake | 2 ++ src/_git-flow | 1 + src/_hledger | 2 +- src/_httpie | 2 ++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/_chromium b/src/_chromium index 25aa19b..7a2e1dc 100644 --- a/src/_chromium +++ b/src/_chromium @@ -84,7 +84,8 @@ _arguments \ _chromium_proxyurls () { #TODO: semicolon separated urls not yet implemented # mostly copied from _urls - local ipre scheme host user uhosts ret=1 expl match glob suf + local ipre scheme host user uhosts ret=1 expl glob suf + local -a match mbegin mend local localhttp zstyle -a ":completion:${curcontext}:urls" local localhttp local localhttp_servername="$localhttp[1]" diff --git a/src/_cmake b/src/_cmake index 84e5d37..f88b3d8 100644 --- a/src/_cmake +++ b/src/_cmake @@ -166,6 +166,7 @@ _cmake_build_presets() { (( $+functions[_cmake_json_field] )) || _cmake_json_field() { local json="$1" key="$2" + local -a match mbegin mend # Non-greedy match of: "key" : " value " if [[ $json =~ "\"$key\"[[:space:]]*:[[:space:]]*\"([^\"]*)\"" ]]; then print -r -- "$match[1]" @@ -213,6 +214,7 @@ _cmake_json_inherited_field() { fi local parent + local -a match mbegin mend if [[ $block =~ '"inherits"[[:space:]]*:[[:space:]]*\[([^]]*)\]' ]]; then for parent in ${(s:,:)match[1]}; do parent=${parent//[\"[:space:]]/} diff --git a/src/_git-flow b/src/_git-flow index ae65758..51458e5 100644 --- a/src/_git-flow +++ b/src/_git-flow @@ -346,6 +346,7 @@ __git_flow_feature_list() { __git_flow_remote() { local expl gitdir remotes + local -a match mbegin mend gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) __git_flow_command_successful || return diff --git a/src/_hledger b/src/_hledger index 072e890..62940c9 100644 --- a/src/_hledger +++ b/src/_hledger @@ -234,7 +234,7 @@ while (( $#state )); do ;; query) - local -a accs keywords + local -a accs keywords match mbegin mend keywords=( 'acct\::match account names' 'code\::match by transaction code' diff --git a/src/_httpie b/src/_httpie index 45840b2..cb2b6f7 100644 --- a/src/_httpie +++ b/src/_httpie @@ -43,6 +43,7 @@ _httpie_params() { local ret=1 expl + local -a match mbegin mend # or a url if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then @@ -123,6 +124,7 @@ _httpie_urls() { _httpie_printflags() { local ret=1 + local -a match mbegin mend # not sure why this is necessary, but it will complete "-pH" style without it [[ $IPREFIX == "-p" ]] && IPREFIX+=" "