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

Better Bash Completion #554

Closed
starcraftman opened this issue May 25, 2015 · 5 comments
Closed

Better Bash Completion #554

starcraftman opened this issue May 25, 2015 · 5 comments

Comments

@starcraftman
Copy link

There are some problems with current bash completion this project provides. May apply to zsh as well, though I don't currently have a replacement for that one.

  1. Not distributed as shown by Neither the new bash and zsh completers nor the script to generate them are shipped in the CPAN tar ball #486, even if the generator were packaged it requires the Template.pm module & App::Ack be installed(edit: forgot about the make target for this). For people just fetching the standalone bit of a nuisance having to get whole repo + gen make etc...

  2. The generated bash completion hard codes the strings for long/short opts. You need to regenerate on every change.

  3. Some completions aren't handled well, like ack --type= & ack --type. In the former, no options appear, the latter misses the no equivalents. Some other things like color completion not there.

I noticed all this at this point as I was redoing some of my own bash completion scripts. I believe I've made a bash completer that is a good improvement. You can see it in my own dotfiles here. It uses ack itself to parse the opts. This means that completer should complete any version of ack, past or future.

I didn't make a PR because I think this has to be discussed re your mailing list & also something similar would have to be done for zsh I suppose. As a consequence of this change, you could simply point people to a link for the completer rather than building it That's tangential though, I'd mainly just like the default bash completion better for users.

@starcraftman
Copy link
Author

Regarding zsh completion, I forgot to point out this excellent project which I use. https://github.com/zsh-users/zsh-completions If you guys wanted you could simply ensure that _ack was up to date and direct users to download it/the repo.

@hoelzro
Copy link
Collaborator

hoelzro commented May 26, 2015

Hi @starcraftman, thanks for the input! To address each of your points...

  • The generated files should be distributed in the tarballs, but the generating scripts are fairly new.
  • The bash script hard codes options so that ack --help doesn't need to be run every time the user hits tab; it looks like the zsh script still does this to fill in user-defined types, so that could probably stand to change.
  • ack --type completion probably doesn't work as well in bash because I mainly did work for the zsh version; any fixes via a PR would be appreciated!

Why don't you open up a post on the mailing list to discuss this; I think you've pointed out some valid problems, though, so opening up a PR to address them would be spectacular. We're in kind of a code freeze at the moment, but your changes would probably go out in 2.18!

@petdance
Copy link
Collaborator

Personally, I would rather point people at the zsh-completions project than to distribute the file as part of the ack distro.

@starcraftman
Copy link
Author

@hoelzro To clarify on point 2, I employ caching to avoid this on every tab. The parsing happens only once per terminal session (i.e. the first tab complete of ack), which seems an acceptable trade off. See here.

I did make a mailing list post, just linked to this topic so I didn't have to rewrite. I only mailed users, that seemed to be suggested.

Re generator, that makes more sense that you package the output files. Though if I were to make a PR to put in my bash completion, then you'd only need to generate the zsh one, if that.

@petdance
Copy link
Collaborator

There will probably be no more releases of ack 2. If this is still a relevant idea, please submit it to the ack3 repo at https://github.com/beyondgrep/ack3.

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

No branches or pull requests

3 participants