Safe Haskell | None |
---|---|
Language | Haskell2010 |
Common code for parsing command line options based on getopt.
Synopsis
- type FunOptDescr cfg = OptDescr (Either (IO ()) (cfg -> cfg))
- mainWithOptions :: cfg -> [FunOptDescr cfg] -> String -> ([String] -> cfg -> Maybe (IO ())) -> String -> [String] -> IO ()
- commonOptions :: String -> String -> [FunOptDescr cfg] -> [FunOptDescr cfg]
- optionsError :: String -> IO ()
- module System.Console.GetOpt
Documentation
type FunOptDescr cfg = OptDescr (Either (IO ()) (cfg -> cfg)) Source #
A command line option that either purely updates a configuration, or performs an IO action (and stops).
mainWithOptions :: cfg -> [FunOptDescr cfg] -> String -> ([String] -> cfg -> Maybe (IO ())) -> String -> [String] -> IO () Source #
Generate a main action that parses the given command line options
(while always adding commonOptions
).
commonOptions :: String -> String -> [FunOptDescr cfg] -> [FunOptDescr cfg] Source #
Common definitions for -v
and -h
, given the list of all other
options.
optionsError :: String -> IO () Source #
Terminate the program with this error message (but don't report
it as an ICE, as happens with error
).
module System.Console.GetOpt