getopt-generics: Create command line interfaces with ease

[ bsd3, console, library, system ] [ Propose Tags ]

Create command line interfaces with ease


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1, 0.1.1, 0.2, 0.3, 0.4, 0.4.1, 0.5, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.7, 0.7.1, 0.7.1.1, 0.8, 0.9, 0.10, 0.10.0.1, 0.11, 0.11.0.1, 0.11.0.2, 0.11.0.3, 0.12, 0.13, 0.13.0.1, 0.13.0.2, 0.13.0.3, 0.13.0.4, 0.13.1.0
Dependencies base (>=4 && <5), base-compat (>=0.8), base-orphans, generics-sop, tagged [details]
License BSD-3-Clause
Copyright Zalora South East Asia Pte Ltd
Author Linh Nguyen, Sönke Hahn
Maintainer linh.nguyen@zalora.com, soenke.hahn@zalora.com
Category Console, System
Home page https://github.com/zalora/getopt-generics#readme
Bug tracker https://github.com/zalora/getopt-generics/issues
Source repo head: git clone https://github.com/zalora/getopt-generics
Uploaded by SoenkeHahn at 2015-09-27T12:08:43Z
Distributions Arch:0.13.1.0, Debian:0.13.0.4, LTSHaskell:0.13.1.0, NixOS:0.13.1.0, Stackage:0.13.1.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 22745 total (94 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2015-09-27 [all 1 reports]

Readme for getopt-generics-0.11

[back to package description]

getopt-generics

Status

This library is experimental.

Usage

getopt-generics tries to make it very simple to create command line interfaces. Here's an example:

import WithCli

main :: IO ()
main = withCli run

run :: String -> Int -> Bool -> IO ()
run s i b = print (s, i, b)

This is how the program behaves in a shell:

$ program foo 42 true
("foo",42,True)
$ program --help
program [OPTIONS] STRING INTEGER BOOL
  -h  --help  show help and exit
$ program foo 42 bar
cannot parse as BOOL: bar
# exit-code 1
$ program
missing argument of type STRING
missing argument of type INTEGER
missing argument of type BOOL
# exit-code 1
$ program foo 42 yes bar
unknown argument: bar
# exit-code 1