Copyright | (c) Simon Bergot |
---|---|
License | BSD3 |
Maintainer | simon.bergot@gmail.com |
Stability | unstable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Functions used to build and run command line applications.
- withParseResult :: ParserSpec a -> (a -> IO ()) -> IO ()
- runApp :: CmdLnInterface a -> (a -> IO ()) -> IO ()
- parseArgs :: Args -> CmdLnInterface a -> ParseResult a
- parseNiceArgs :: NiceArgs -> CmdLnInterface a -> ParseResult a
- mkApp :: ParserSpec a -> IO (CmdLnInterface a)
- mkDefaultApp :: ParserSpec a -> String -> CmdLnInterface a
- defaultSpecialFlags :: [SpecialFlag a]
- setAppDescr :: CmdLnInterface a -> String -> CmdLnInterface a
- setAppEpilog :: CmdLnInterface a -> String -> CmdLnInterface a
- setAppName :: CmdLnInterface a -> String -> CmdLnInterface a
Running a parser
withParseResult :: ParserSpec a -> (a -> IO ()) -> IO () Source
:: CmdLnInterface a | Command line spec |
-> (a -> IO ()) | Process to run if the parsing success |
-> IO () |
Runs a command line application with the user provided arguments. If the parsing succeeds, run the application. Print the returned message otherwise
:: Args | Arguments to parse |
-> CmdLnInterface a | Command line spec |
-> ParseResult a |
Parse the arguments with the parser provided to the function.
:: NiceArgs | Arguments to parse |
-> CmdLnInterface a | Command line spec |
-> ParseResult a |
Parse the arguments with the parser provided to the function.
Building a parser
mkApp :: ParserSpec a -> IO (CmdLnInterface a) Source
Build an application with no version/description and with a name equal to the file name.
mkDefaultApp :: ParserSpec a -> String -> CmdLnInterface a Source
Build an application with no version/description and with a name equal to the provided String.
defaultSpecialFlags :: [SpecialFlag a] Source
default version and help special actions
setAppDescr :: CmdLnInterface a -> String -> CmdLnInterface a Source
Set the description of an interface
setAppEpilog :: CmdLnInterface a -> String -> CmdLnInterface a Source
Set the bottom text of an interface
setAppName :: CmdLnInterface a -> String -> CmdLnInterface a Source
Set the name of an interface