-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple command args parsing and execution -- -- This is a small wrapper over optparse-applicative which allows -- combining args parsers directly with IO commands. For subcommands this -- can avoid type boilerplate. It also provides some compact aliases for -- options with their Mod's. @package simple-cmd-args @version 0.1.2 -- | 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. module SimpleCmdArgs -- | Parser executor (allows interspersed args and options) -- --
-- simpleCmdArgs (Just version) "summary" "program description" $ myCommand <$> myOptParser <*> myargsParser --simpleCmdArgs :: Maybe Version -> String -> String -> Parser (IO ()) -> IO () -- | Parser executor without interspersing options and args -- --
-- simpleCmdArgs' Nothing "summary" "program description" $ myCommand <$> myOptParser <*> myargsParser --simpleCmdArgs' :: Maybe Version -> String -> String -> Parser (IO ()) -> IO () -- | Generic parser executor with explicit info modifiers simpleCmdArgsWithMods :: Maybe Version -> InfoMod (IO ()) -> Parser (IO ()) -> IO () -- |
-- Subcommand "command" "help description text" $ myCommand <$> optParser --data Subcommand Subcommand :: String -> String -> Parser (IO ()) -> Subcommand -- | list of Subcommand that can be run by simpleCmdArgs subcommands :: [Subcommand] -> Parser (IO ()) -- | A string arg parser with a METAVAR for help strArg :: String -> Parser String -- | switch with Mods -- --
-- switchWith 'o' "option" "help description" --switchWith :: Char -> String -> String -> Parser Bool -- | flag with Mods -- --
-- flagWith offVal onVal 'f' "flag" "help description" --flagWith :: a -> a -> Char -> String -> String -> Parser a -- | flag' with Mods -- --
-- flagWith' val 'f' "flag" "help description" --flagWith' :: a -> Char -> String -> String -> Parser a -- | Mods for a switch. -- --
-- switchMods 'o' "option" "help description" --switchMods :: HasName f => Char -> String -> String -> Mod f a -- | strOption with Mods -- --
-- strOptionWith 'o' "option" "METAVAR" "help description" --strOptionWith :: Char -> String -> String -> String -> Parser String -- | option with Mods -- --
-- optionWith auto 'o' "option" "METAVAR" "help description" --optionWith :: ReadM a -> Char -> String -> String -> String -> Parser a -- | Mods for a mandatory option. -- --
-- optionMods 'o' "option" "METAVAR" "help description" --optionMods :: (HasMetavar f, HasName f) => Char -> String -> String -> String -> Mod f a -- | strOptional with Mods -- --
-- strOptionalWith 'o' "option" "METAVAR" "help description" default --strOptionalWith :: Char -> String -> String -> String -> String -> Parser String -- | optional option with Mods, includes a default value. -- --
-- optionalWith auto 'o' "option" "METAVAR" "help description" default --optionalWith :: ReadM a -> Char -> String -> String -> String -> a -> Parser a -- | Mods for an optional option: includes a default value. -- --
-- optionalMods 'o' "option" "METAVAR" "help description" default --optionalMods :: (HasMetavar f, HasName f, HasValue f) => Char -> String -> String -> String -> a -> Mod f a -- | argument with METAVAR -- --
-- argumentWith auto "METAVAR" --argumentWith :: ReadM a -> String -> Parser a -- | A Parser a is an option parser returning a value of type -- a. data Parser a -- | Option reader based on the Read type class. auto :: Read a => ReadM a -- | One or none. optional :: Alternative f => f a -> f (Maybe a)