optparse-applicative icon indicating copy to clipboard operation
optparse-applicative copied to clipboard

Allow setting the complete -G option

Open dag opened this issue 13 years ago • 2 comments

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

dag avatar Aug 05 '12 15:08 dag

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.

pcapriotti avatar Aug 05 '12 16:08 pcapriotti

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.

mgsloan avatar Mar 21 '17 21:03 mgsloan