Declare match, mbegin, mend arrays when using regexp

This commit is contained in:
Shohei YOSHIDA 2026-08-10 09:35:00 +09:00
parent e099c4a228
commit 9ebbd27361
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
5 changed files with 8 additions and 2 deletions

View File

@ -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]"

View File

@ -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" <ws> : <ws> " 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:]]/}

View File

@ -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

View File

@ -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'

View File

@ -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+=" "