document mxc2http better
This commit is contained in:
parent
df0eb72325
commit
c82ec04134
|
@ -1,6 +1,7 @@
|
||||||
#compdef mxc2http
|
#compdef mxc2http
|
||||||
|
|
||||||
_arguments '-h[short help text]' \
|
_arguments '-h[short help text]' \
|
||||||
|
'--help[short help text]' \
|
||||||
'--server[server to use as host]:server:' \
|
'--server[server to use as host]:server:' \
|
||||||
'*:url:_urls'
|
'*:url:_urls'
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# Converts mxc:// URLs into https:// URLs
|
# Converts mxc:// URLs into https:// URLs
|
||||||
|
# <https://spec.matrix.org/v1.2/client-server-api/#get_matrixmediav3downloadservernamemediaid>
|
||||||
|
|
||||||
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
||||||
|
|
||||||
zmodload zsh/zutil
|
zmodload zsh/zutil
|
||||||
local -a o_help=()
|
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 -help=o_help -server:=o_server
|
||||||
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
|
if [[ ${#o_help} -ne 0 || ! -v 1 ]]; then
|
||||||
local ret=$(( ${#o_help} ^ 1 ))
|
local ret=$(( ${#o_help} ^ 1 ))
|
||||||
print -u $(( 1 + ${ret} )) "usage: ${0} [-h] <URL> …"
|
print -u $(( 1 + ${ret} )) "usage: ${0} [-h|--help] [--server HOST] <URL> …"
|
||||||
return ${ret}
|
return ${ret}
|
||||||
fi
|
fi
|
||||||
local -a urls=(${@})
|
local -a urls=(${@})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user