From c82ec04134d54f6ae8a8115c224dc284c499c724 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 29 Aug 2022 18:15:35 +0200 Subject: [PATCH] document mxc2http better --- .config/zsh/completions/_mxc2http | 1 + .config/zsh/functions/mxc2http | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/zsh/completions/_mxc2http b/.config/zsh/completions/_mxc2http index 4c6afc2..cf0a873 100644 --- a/.config/zsh/completions/_mxc2http +++ b/.config/zsh/completions/_mxc2http @@ -1,6 +1,7 @@ #compdef mxc2http _arguments '-h[short help text]' \ + '--help[short help text]' \ '--server[server to use as host]:server:' \ '*:url:_urls' diff --git a/.config/zsh/functions/mxc2http b/.config/zsh/functions/mxc2http index 7cf092d..ced4f92 100755 --- a/.config/zsh/functions/mxc2http +++ b/.config/zsh/functions/mxc2http @@ -1,15 +1,16 @@ #!/usr/bin/env zsh # Converts mxc:// URLs into https:// URLs +# setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL zmodload zsh/zutil local -a o_help=() 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 local ret=$(( ${#o_help} ^ 1 )) - print -u $(( 1 + ${ret} )) "usage: ${0} [-h] …" + print -u $(( 1 + ${ret} )) "usage: ${0} [-h|--help] [--server HOST] …" return ${ret} fi local -a urls=(${@})