Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab completion for commands, sub-commands and options #1690

Open
Guillawme opened this issue Mar 24, 2024 · 6 comments
Open

Tab completion for commands, sub-commands and options #1690

Guillawme opened this issue Mar 24, 2024 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Guillawme
Copy link

Is your feature request related to a problem? Please describe.
I can't get tab completion for qsv commands, sub-commands and options, while I can get them when using xsv (unfortunately no longer maintained). The shell I use, fish, can automatically generate completions from man pages, but qsv doesn't have a man page.

Describe the solution you'd like
Tab completion that works in the fish shell for qsv commands, sub-commands and options, regardless of how this is implemented (an exhaustive man page that fish can parse would be sufficient, and would also improve the documentation; but any other mechanism would be fine too).

Describe alternatives you've considered
I use xsv interactively to get tab completions, and qsv in scripts once I have interactively figured out the command I need. But this only works for the set of commands present in both programs.

@ondohotola
Copy link

ondohotola commented Mar 24, 2024 via email

@jqnatividad
Copy link
Owner

As @ondohotola said, feel free to submit bash_completions!

And you don't have to start from scratch! Perhaps, you can build on xsv's bash completion as qsv shares its docopt CLI parser.

https://github.com/jqnatividad/docopt.rs?tab=readme-ov-file#tab-completion-support

@jqnatividad jqnatividad added enhancement New feature or request help wanted Extra attention is needed labels Mar 24, 2024
@Guillawme
Copy link
Author

Sorry, I didn't make this clear in the first message, but I wrote this from the point of view of a user, not a developer. I have no clue how to follow your suggestions. Moreover, I don't use bash interactively, only fish. Fish can generate completions automatically in one command, but does it by parsing a man page, and qsv does not provide one.

is that not mainly a shell issue?

All I know is that xsv gives me tab completions, without me having done anything special other than installing it, while qsv doesn't. It would be helpful (surely not only to me) if it did.
From this perspective, it doesn't look like a shell issue: some tools provide completions out of the box, the shell I use provides a mechanism to automatically generate completions for the tools that don't come with them. Unfortunately qsv provides none of these options.

Tab completion is great for discoverability, so this suggestion seems to fit well the stated goal of being "As Easy to Use as Possible" (quoting the README). I understand that given limited time, other features probably need more attention, so no worries. And sorry I can't offer to contribute (I will try, if I ever take time to figure this out).

@jqnatividad
Copy link
Owner

jqnatividad commented Mar 24, 2024

Thanks for clarifying @Guillawme . Using docopt, and remaining with it with our own qsv specific fork was a "considered" decision - #463, so I doubt I'll ever create man pages unless somebody from the community decides to do so.

What we are doing is working on qsv-pro - which aims to make it much easier to leverage the power of qsv - going beyond tab completions (which, is still only a small subset of Data Analysts - folks who are comfortable with a command line interface) to something that ANYBODY can use.

The spreadsheet interface will allow you to load a CSV/spreadsheet, even a very large one that regular spreadsheet software cannot load - apply qsv operations to it; run recipes (that you can download from a recipe library, and you can even create, modify and share your recipes - recipes can be written with Luau or Python); work with different cloud providers, etc.

Recipes should make it easier to use qsv, but we're also experimenting with a natural language interface which will write the qsv command for you based on a natural language request.

I touched on it in a recent presentation I gave at the Mar 2024 CKAN Monthly Live and we'll dive into it a bit more at csvconf.com.

Time allowing, I may get around to enabling tab completion, starting with bash first by renovating the existing docopt-wordlist-bash code. Hopefully, some other member of the community contributes fish shell integration.

@rzmk
Copy link
Collaborator

rzmk commented Mar 27, 2024

#1307 may be relevant for similar implementations.

jqnatividad added a commit that referenced this issue Apr 9, 2024
contrib: add sample Bashly completions implementation

Amazing! Thanks for this very useful contribution @rzmk !

I'll mark #1690 resolved for now as folks can always iterate on this awesome contrib!
@jqnatividad
Copy link
Owner

Thanks @rzmk for your Bashly implementation.

Hopefully, that is but the first tab completion contribution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants