Skip to content

soenkehahn/getopt-generics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

58a0814 · Nov 4, 2021
Nov 4, 2021
Nov 11, 2015
Sep 2, 2019
Nov 11, 2015
Mar 18, 2018
Mar 18, 2015
May 13, 2021
Mar 21, 2015
Nov 10, 2015
Sep 2, 2019
Sep 2, 2019
May 1, 2017
Aug 4, 2019
Mar 18, 2018
Aug 4, 2019
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021
Sep 2, 2019
Sep 2, 2019
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021
Nov 4, 2021

Repository files navigation

getopt-generics

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

About

Create command line interfaces with ease

Resources

License

Stars

Watchers

Forks

Packages

No packages published