Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This library provides a thin layer on optparse-applicative
argument and option parsing, using Parser (IO ())
,
applying commands directly to their argument parsing.
A few option Mod functions are also provided.
Synopsis
- simpleCmdArgs :: Maybe Version -> String -> String -> Parser (IO ()) -> IO ()
- simpleCmdArgs' :: Maybe Version -> String -> String -> Parser (IO ()) -> IO ()
- data Subcommand = Subcommand String String (Parser (IO ()))
- subcommands :: [Subcommand] -> Parser (IO ())
- strArg :: String -> Parser String
- switchMods :: HasName f => Char -> String -> String -> Mod f a
- optionMods :: (HasMetavar f, HasName f) => Char -> String -> String -> String -> Mod f a
- optionalMods :: (HasMetavar f, HasName f, HasValue f) => Char -> String -> String -> String -> a -> Mod f a
Documentation
:: Maybe Version | version string |
-> String | header |
-> String | program description |
-> Parser (IO ()) | commands |
-> IO () |
Parser executor (allows interspersed args and options)
simpleCmdArgs (Just version) "summary" "program description" $ myCommand <$> myOptParser <*> myargsParser
:: Maybe Version | version string |
-> String | header |
-> String | program description |
-> Parser (IO ()) | commands |
-> IO () |
Parser executor without interspersing options and args
simpleCmdArgs' Nothing "summary" "program description" $ myCommand <$> myOptParser <*> myargsParser
data Subcommand Source #
Subcommand "command" "help description text" $ myCommand <$> optParser
Subcommand String String (Parser (IO ())) |
subcommands :: [Subcommand] -> Parser (IO ()) Source #
list of Subcommand
that can be run by simpleCmdArgs
switchMods :: HasName f => Char -> String -> String -> Mod f a Source #
Mod
s for a switch.
switchMods 'o' "option" "help description"
optionMods :: (HasMetavar f, HasName f) => Char -> String -> String -> String -> Mod f a Source #
Mod
s for a mandatory option.
optionMods 'o' "option" "METAVAR" "help description"