zsh functions: make ret local variable

This commit is contained in:
tastytea 2022-04-17 06:59:04 +02:00
parent 5c546cc5b8
commit 0506b66d91
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
4 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ local -a o_help=()
local -a o_server=() local -a o_server=()
zparseopts -D -K -- h=o_help -server:=o_server zparseopts -D -K -- h=o_help -server:=o_server
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
ret=$(( ${#o_help} ^ 1 )) local ret=$(( ${#o_help} ^ 1 ))
print -u $(( 1 + ${ret} )) "usage: ${0} [-h] <URL> …" print -u $(( 1 + ${ret} )) "usage: ${0} [-h] <URL> …"
return ${ret} return ${ret}
fi fi

View File

@ -8,7 +8,7 @@ local -a o_dir=(-d "")
local -a o_help=() local -a o_help=()
zparseopts -D -K -- d:=o_dir h=o_help zparseopts -D -K -- d:=o_dir h=o_help
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
ret=$(( ${#o_help} ^ 1 )) local ret=$(( ${#o_help} ^ 1 ))
print -u $(( 1 + ${ret} )) "usage: ${0} [-h] [-d REMOTE SUBDIR] <FILE> …" print -u $(( 1 + ${ret} )) "usage: ${0} [-h] [-d REMOTE SUBDIR] <FILE> …"
return ${ret} return ${ret}
fi fi

View File

@ -8,7 +8,7 @@ zmodload zsh/zutil
local -a o_help=() local -a o_help=()
zparseopts -D -K -- h=o_help zparseopts -D -K -- h=o_help
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
ret=$(( ${#o_help} ^ 1 )) local ret=$(( ${#o_help} ^ 1 ))
print -u $(( 1 + ${ret} )) "usage: ${0} [-h] <URL> …" print -u $(( 1 + ${ret} )) "usage: ${0} [-h] <URL> …"
return ${ret} return ${ret}
fi fi

View File

@ -7,7 +7,7 @@ zmodload zsh/zutil
local -a o_help=() local -a o_help=()
zparseopts -D -K -- h=o_help zparseopts -D -K -- h=o_help
if [[ ${#o_help} -ne 0 || ! -v 2 ]] || [[ ${1} != "list" && ! -v 3 ]]; then if [[ ${#o_help} -ne 0 || ! -v 2 ]] || [[ ${1} != "list" && ! -v 3 ]]; then
ret=$(( ${#o_help} ^ 1 )) local ret=$(( ${#o_help} ^ 1 ))
print -u $(( 1 + ${ret} )) "usage: ${0} [-h] list|add|del|find <FILE|DIR> [TAG] …" print -u $(( 1 + ${ret} )) "usage: ${0} [-h] list|add|del|find <FILE|DIR> [TAG] …"
return ${ret} return ${ret}
fi fi