Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.88k stars 481 forks source link

zsh and bash completion #1864

Closed teto closed 7 months ago

teto commented 1 year ago

Problem to solve

I would like to have zsh and bash completion. Maybe it's already possible and they are not installed by my linux distribution but I had a quick look on this repo and was not sure if this is possible ?

fabricereix commented 1 year ago

We haven't created a completion file yet. It will be indeed interesting to have one. Similar to the vim syntax file, we could provide it in contrib/ folder. In the long term, it should be packaged with Hurl (in the same package).

teto commented 1 year ago

not sure what argument parsing library you use but usually these libraries can generate the completion out of the box with something like hurl --zsh-completion > _zsh. Might be worth checking out, if hurl uses something like clap for instance

mawkler commented 8 months ago

It surprised me that hurl doesn't support completion. As a reference, here's how mullvad-vpn's CLI creates its shell completions using the crate clap_complete.

fabricereix commented 8 months ago

I would tend to prefer compile-time completion rather than runtime-completion. We are going to look at it, to see whether to use clap or using simple Python scripts from our option files https://github.com/Orange-OpenSource/hurl/tree/master/docs/spec/options/hurl

jcamiel commented 8 months ago

+1 for generating and committing the static files for completion.

Some examples:

And also how curl is generating its completion files