@hackage / optparse-text

Data.Text helpers for optparse-applicative

Latest0.1.1.0

About

Metadata

  • Last updated , by passy
  • License BSD-3-Clause
  • Categories Development
  • Maintained by: Pascal Hartig <i@passy.me>

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 7.10.3

Readme

optparse-text

Build Status

Helpers for optparse-applicative to deal with Data.Text.

Example

import qualified Data.Text                 as T
import qualified Options.Applicative       as Opt
import qualified Options.Applicative.Text  as OptT

data Options = Options { text    :: T.Text
                       , textArg :: T.Text
                       , textOpt :: T.Text }
  deriving (Eq, Show)

optParser :: Opt.Parser Options
optParser = Options <$> Opt.argument OptT.text ( Opt.metavar "TEXT" )
                 <*> OptT.textArgument ( Opt.metavar "TEXT2" )
                 <*> OptT.textOption ( Opt.long "textopt" )

Status

About to be published.

Alternatives

You may want to consider using optparse-generic which has built-in support for Text and provides a very convient generic interface to optparse avoiding a lot of boilerplate.