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

Allow setting the complete -G option #17

Open
dag opened this issue Aug 5, 2012 · 2 comments
Open

Allow setting the complete -G option #17

dag opened this issue Aug 5, 2012 · 2 comments

Comments

@dag
Copy link
Contributor

dag commented Aug 5, 2012

I want to complete XML files. You can do this with bash completions via -A file -G '*.xml'.

@pcapriotti
Copy link
Owner

Actually, that doesn't seem to do the right thing. Other completion scripts call a _filedir function to complete with a filter. I looked at the source, and I wish I hadn't :)

This whole bash completion thing seems to be held together with duct tape. I think it's best if I reimplement some of the functionality (like file and directory completion) in haskell. I'll probably keep the action modifier, though, because there are a number of completions provided by compgen which can come in handy.

@mgsloan
Copy link

mgsloan commented Mar 21, 2017

I've written a Haskell implementation of path completion, including extension filtering, here: https://github.com/commercialhaskell/stack/blob/24ba0acb22e8e400dc9941e39dbd35b9b9f6fd87/src/Options/Applicative/Builder/Extra.hs#L180

Not sure if it's 100% correct, but seems to work pretty well.

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

No branches or pull requests

3 participants