hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Error in zsh completion

Open aresler opened this issue 9 months ago • 2 comments

Steps:

  1. Create a .hurl file with any request
  2. cd to the file's location
  3. type hurl, then space followed by tab

Expected: I would expect the file name to be completed

Actual:

Error

_arguments:comparguments:327: invalid rest argument definition: *(-H --header)-H[Pass custom header(s) to server]: :
  • hurl 6.1.1 (x86_64-apple-darwin24.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.63.0
  • Installed via Homebrew
  • macOS 15.3.2

aresler avatar Mar 31 '25 21:03 aresler

Thanks @aresler for reporting the issue. We are going to have a look at it.

fabricereix avatar Apr 08 '25 06:04 fabricereix

@fabricereix haven't we fixed this one? I've the impression we've done it...

jcamiel avatar Jun 21 '25 10:06 jcamiel

@jcamiel Just fyi, the issue is still reproduced for me on hurl 6.1.1, as well as on 7.0.0 built from sources on mac.

For anyone affected, a workaround is to create an alias or function wrapper, e.g. in zsh.rc:

hu() {
    hurl $@
}

aresler avatar Jun 24 '25 14:06 aresler

Yes thanks, we've fixed it for bash but have to do it for zsh completion. We'll ship it with 7.0.0

jcamiel avatar Jun 24 '25 15:06 jcamiel

The completion file is quite tricky to understand. Maybe @zottelsheep, you have an idea? You have updated it a few months back, and you seem more familar with szh completion than us. Thanks

fabricereix avatar Jun 27 '25 16:06 fabricereix

@fabricereix this line in the _hurl zsh completion file seems problematic:

    '*(-H --header)'{-H,--header}'[Pass custom header(s) to server]: :' \

It should be:

    '(-H --header)*'{-H,--header}'[Pass custom header(s) to server]: :' \

With this modification, the completion works fine

jcamiel avatar Jun 29 '25 10:06 jcamiel

where do you get it from? from a spec? we can "make it work", but I'm not very comfortable not to understand why. At least the file is committed.

fabricereix avatar Jun 29 '25 20:06 fabricereix

the file is generated by bin/spec/options/generate_completion.py

fabricereix avatar Jun 29 '25 20:06 fabricereix

Hi @aresler, the fix has been merged into master. You can test it if you want.

fabricereix avatar Jul 01 '25 12:07 fabricereix