pcapriotti / optparse-applicative

Applicative option parser
BSD 3-Clause "New" or "Revised" License
910 stars 116 forks source link

Export `requote` from `Options.Applicative.Builder.Completer` #459

Closed janmasrovira closed 2 years ago

janmasrovira commented 2 years ago

The function bashCompleter currently only allows the user to pass an action argument. If you want something fancier, e.g., complete with all files with a certain extension plus directories, you need to define a Completer from scratch. It could look like this:

extCompleter :: Completer
extCompleter = Completer $ \word -> do
  let cmd = unwords ["compgen", "-o", "plusdirs", "-f", "-X", "!*.ext", "--", requote word]
 ...

And it would be very convenient if we could import the helper function requote from the library instead of copy and pasting to our project.

HuwCampbell commented 2 years ago

https://github.com/pcapriotti/optparse-applicative/pull/460

HuwCampbell commented 2 years ago

Done