optparse-enum: An enum-text based toolkit for optparse-applicative

[ bsd3, cli, library, options, parsing, system ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/cdornan/optparse-enum#readme


[Skip to Readme]
Versions [faq] 1.0.0.0
Change log ChangeLog.md
Dependencies base (>=4.8 && <10), enum-text (>=0.5.1.0), fmt (>=0.6), optparse-applicative (>=0.12), text (>=1.2.2.2) [details]
License BSD-3-Clause
Copyright 2019 Chris Dornan
Author Chris Dornan
Maintainer chris@chrisdornan.com
Category System, CLI, Options, Parsing
Home page https://github.com/cdornan/optparse-enum#readme
Bug tracker https://github.com/cdornan/optparse-enum/issues
Source repo head: git clone https://github.com/cdornan/optparse-enum
Uploaded by ChrisDornan at Sun Jul 21 17:14:58 UTC 2019
Distributions NixOS:1.0.0.0
Downloads 81 total (38 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-07-21 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for optparse-enum-1.0.0.0

[back to package description]

optparse-enum

An enum-text based toolkit for optparse-applicative.

A simple but complete example:

{-# LANGUAGE DeriveAnyClass    #-}
{-# LANGUAGE DerivingVia       #-}
{-# LANGUAGE OverloadedStrings #-}

import Fmt
import Text.Enum.Optparse
import Paths_optparse_enum

data Choice
  = C_version
  | C_hello
  deriving (Bounded,Enum,EnumText,Eq,Ord,Show)
  deriving (Buildable,TextParsable) via UsingEnumText Choice

parserDetails ::   ParserDetails
parserDetails =
  ParserDetails
    { _pd_desc   = "optparse-enum example program"
    , _pd_header = "A simple optparse-enum illustrative program"
    , _pd_footer = "See the optparse-enum page on Hackage for details"
    }

main :: IO ()
main = do
  choice <- parseIO parserDetails enumSwitchesP
  case choice of
    C_version -> print    version
    C_hello   -> putStrLn "Hello!"