cli-builder: Simple project template from stack

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.


Please see

[Skip to ReadMe]


Versions0.1.0, 0.1.0
Change logNone available
Dependenciesbase (>=4.7 && <5), either, exceptions (>=, optparse-applicative (>=0.12 && <0.14), transformers (>= && <0.6) [details]
Copyright2016 uecmma
Home page
Bug tracker
Source repositoryhead: git clone git+
UploadedWed Nov 9 09:51:11 UTC 2016 by mizunashi_mana




Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainers' corner

For package maintainers and hackage trustees

Readme for cli-builder-0.1.0

[back to package description]

CLI Builder

This packages contains builders to make cli application easily based optparse-applicative.

Getting Started

Here is a simple example:

{-# LANGUAGE RecordWildCards #-}

import System.CLI.Builder

data Options = Options
  { isSampleOption :: Bool
  } deriving (Eq, Show)

optionsParser :: OptionParser Options
optionsParser = Options
  <$> switch (long "sample" <> help "Sample switch")

cliInfo :: CLIInfo
cliInfo = baseCLIInfo "Simple CLI" "Example for simple CLI"

run :: Options -> IO ()
run Options{..} = do
  putStrLn "Sample application"
  putStrLn $ "Is sample: " ++ show isSampleOption

main :: IO ()
main = buildSimpleCLI cliInfo optionsParser run

This action is such as:

$ sampleApp
Sample application
Is sample: False
$ sampleApp --sample
Sample application
Is sample: True
$ sampleApp --help
Simple CLI

Usage: <interactive> [--help]
  Example for simple CLI

Available options:
  --help                   Show this help text
  --sample                 Sample switch

For more examples, see examples.