Allow setting the complete -G option
I want to complete XML files. You can do this with bash completions via -A file -G '*.xml'.
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.
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.