Fix zsh completion

This commit is contained in:
Fabrice Reix 2025-06-30 19:24:06 +02:00 committed by hurl-bot
parent d4a1b103dc
commit 85aeff183c
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D
2 changed files with 5 additions and 7 deletions

View File

@ -123,17 +123,15 @@ def zsh_option(option: Option):
action = ": :"
if option.short and option.long:
option_specifier = (
f"(-{option.short} --{option.long})'{{-{option.short},--{option.long}}}'"
)
option_specifier = f"(-{option.short} --{option.long}){cardinality}'{{-{option.short},--{option.long}}}'"
elif option.long:
option_specifier = f"--{option.long}"
option_specifier = f"{cardinality}--{option.long}"
elif option.short:
option_specifier = f"-{option.short}"
option_specifier = f"{cardinality}-{option.short}"
else:
raise ValueError("No long or short option specified")
return f"'{cardinality}{option_specifier}[{help}]{action}' \\"
return f"'{option_specifier}[{help}]{action}' \\"
def generate_fish_completion(name: str, options: List[Option]):

View File

@ -34,7 +34,7 @@ _hurl() {
'--location-trusted[Follow redirects but allows sending the name + password to all hosts that the site may redirect to]' \
'--from-entry[Execute Hurl file from ENTRY_NUMBER (starting at 1)]: :' \
'*--glob[Specify input files that match the given GLOB. Multiple glob flags may be used]: :' \
'*(-H --header)'{-H,--header}'[Pass custom header(s) to server]: :' \
'(-H --header)*'{-H,--header}'[Pass custom header(s) to server]: :' \
'(-0 --http1.0)'{-0,--http1.0}'[Tell Hurl to use HTTP version 1.0]' \
'--http1.1[Tell Hurl to use HTTP version 1.1]' \
'--http2[Tell Hurl to use HTTP version 2]' \