name: options version: 1.0 license: MIT license-file: license.txt author: John Millikin maintainer: John Millikin build-type: Simple cabal-version: >= 1.8 category: Console stability: stable homepage: https://john-millikin.com/software/haskell-options/ synopsis: A powerful and easy-to-use command-line option parser. description: The @options@ package lets library and application developers easily work with command-line options. . The following example is a full program that can accept two options, @--message@ and @--quiet@: . @ import Control.Applicative import Options . data MainOptions = MainOptions { optMessage :: String , optQuiet :: Bool } . instance 'Options' MainOptions where defineOptions = pure MainOptions \<*\> simpleOption \"message\" \"Hello world!\" \"A message to show the user.\" \<*\> simpleOption \"quiet\" False \"Whether to be quiet.\" . main :: IO () main = runCommand $ \\opts args -> do if optQuiet opts then return () else putStrLn (optMessage opts) @ . >$ ./hello >Hello world! >$ ./hello --message='ciao mondo' >ciao mondo >$ ./hello --quiet >$ . In addition, this library will automatically create documentation options such as @--help@ and @--help-all@: . >$ ./hello --help >Help Options: > -h, --help > Show option summary. > --help-all > Show all help options. > >Application Options: > --message :: text > A message to show the user. > default: "Hello world!" > --quiet :: bool > Whether to be quiet. > default: false extra-source-files: cbits/hoehrmann_utf8.c cbits/utf8.c source-repository head type: git location: https://john-millikin.com/code/haskell-options/ source-repository this type: git location: https://john-millikin.com/code/haskell-options/ tag: haskell-options_1.0 library ghc-options: -Wall -O2 cc-options: -Wall hs-source-dirs: lib if !os(windows) && impl(ghc < 7.2) cpp-options: -DOPTIONS_ENCODING_UTF8 c-sources: cbits/utf8.c build-depends: bytestring >= 0.9 if impl(ghc > 7.4) ghc-options: -fwarn-unsafe build-depends: base >= 4.1 && < 5.0 , containers >= 0.1 , monads-tf >= 0.1 , transformers >= 0.2 exposed-modules: Options other-modules: Options.Help Options.Tokenize Options.Types Options.Util test-suite options_tests type: exitcode-stdio-1.0 main-is: OptionsTests.hs ghc-options: -Wall -O2 cc-options: -Wall hs-source-dirs: lib,tests if !os(windows) && impl(ghc < 7.2) cpp-options: -DOPTIONS_ENCODING_UTF8 c-sources: cbits/utf8.c build-depends: bytestring >= 0.9 build-depends: base >= 4.0 && < 5.0 , chell >= 0.3.1 && < 0.4 , chell-quickcheck >= 0.2 && < 0.3 , containers >= 0.1 , monads-tf >= 0.1 , transformers >= 0.2 other-modules: OptionsTests.Help OptionsTests.OptionTypes OptionsTests.StringParsing OptionsTests.Tokenize OptionsTests.Util