Skip to content

Conversation

@balki
Copy link
Contributor

@balki balki commented Oct 8, 2024

POC for bash completion support. It does two things as for now

  1. Following then, it completes a verb
  2. When tab is hit twice after completing a verb, it shows help for the verb

Demo

demo

Setup

❯ mlr completion     
Usage: mlr completion SHELL
Supported shells: bash

Add below to your bashrc to enable completion
source <(mlr completion bash)

❯ mlr completion bash
complete -o nospace -o nosort -C "mlr _complete_bash" mlr


Let me know if you like the approach. Can be enhanced further

  • zsh completion
  • complete global flags
  • complete verb flags
  • complete field names from input for some verbs like cut -f.. (extracted from first line of input in --from flag)

@balki
Copy link
Contributor Author

balki commented Oct 18, 2024

@johnkerl Are you ok with the approach for completion? Reading flags may require bit of refactor in command line parsing logic.

@johnkerl
Copy link
Owner

@balki Hi and sorry for the delay!

This is AWESOME stuff!!! 😎

Agreed re all four checkboxes -- if you're up for it, these are all great! It's better to have some completion than none at all, so, I'm happy to take these as separate PRs.

I think bash is more popular than zsh but I really don't have data -- in any case ideally one would have support for both.

I'm happy to work with you on refactoring the command-line-parsing logic ...

Copy link
Owner

@johnkerl johnkerl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see requested change

@balki
Copy link
Contributor Author

balki commented Nov 1, 2024

Thank you! Will try to work on this in next few weeks.

Yes bash is more popular and will start with bash as it is simpler. However zsh completion is more powerful and useful. E.g the flag completion has the help text which is very helpful. And mac os default shell is zsh.

@J0J0
Copy link

J0J0 commented Apr 11, 2025

Has there been any progress on this?

(Mostly, i'm asking to avoid duplicate work. If there hasn't been any work on zsh completion, i might have a look at it ...)

@johnkerl
Copy link
Owner

Has there been any progress on this?

There has not :(

(Mostly, i'm asking to avoid duplicate work. If there hasn't been any work on zsh completion, i might have a look at it ...)

I would love that! :)

@balki
Copy link
Contributor Author

balki commented Jun 28, 2025

Apologies. I am not working on this anymore for now. Anyone interested, please take over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants