-- 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.8 -- | This library provides a thin layer on optparse-applicative argument -- and option parsing, using Parser (IO ()), applying commands -- directly to their argument parsing. -- -- Some 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 -- | Create a 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 -- | switchWith with only long option -- --
-- switchLongWith "option" "help description" --switchLongWith :: 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 -- | flagWith with only long option -- --
-- flagLongWith offVal onVal "flag" "help description" --flagLongWith :: a -> a -> String -> String -> Parser a -- | flagWith' with only long option -- --
-- flagLongWith' val "flag" "help description" --flagLongWith' :: a -> String -> String -> Parser a -- | Mods for a switch. -- --
-- switchMods 'o' "option" "help description" --switchMods :: HasName f => Char -> String -> String -> Mod f a -- | Mods for a switch. -- --
-- switchLongMods "option" "help description" --switchLongMods :: HasName f => String -> String -> Mod f a -- | strOption with Mods -- --
-- strOptionWith 'o' "option" "METAVAR" "help description" --strOptionWith :: Char -> String -> String -> String -> Parser String -- | strOptionWith with only long option -- --
-- strOptionLongWith "option" "METAVAR" "help description" --strOptionLongWith :: String -> String -> String -> Parser String -- | option with Mods -- --
-- optionWith auto 'o' "option" "METAVAR" "help description" --optionWith :: ReadM a -> Char -> String -> String -> String -> Parser a -- | optionWith with only long option -- --
-- optionLongWith auto "option" "METAVAR" "help description" --optionLongWith :: ReadM a -> 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 -- | optionMods with only long option -- --
-- optionLongMods "option" "METAVAR" "help description" --optionLongMods :: (HasMetavar f, HasName f) => String -> String -> String -> Mod f a -- | strOptional with Mods -- --
-- strOptionalWith 'o' "option" "METAVAR" "help description" default --strOptionalWith :: Char -> String -> String -> String -> String -> Parser String -- | strOptionalWith with only long option -- --
-- strOptionalLongWith "option" "METAVAR" "help description" default --strOptionalLongWith :: 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 -- | optionalWith with only long option -- --
-- optionalLongWith auto "option" "METAVAR" "help description" default --optionalLongWith :: ReadM a -> 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 -- | optionalMods with only long option -- --
-- optionalLongMods "option" "METAVAR" "help description" default --optionalLongMods :: (HasMetavar f, HasName f, HasValue f) => 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 -- | A newtype over 'ReaderT String Except', used by option readers. data ReadM a -- | Option reader based on the Read type class. auto :: Read a => ReadM a -- | Zero or more. many :: Alternative f => f a -> f [a] -- | Convert a function producing an Either into a reader. -- -- As an example, one can create a ReadM from an attoparsec Parser easily -- with -- --
-- import qualified Data.Attoparsec.Text as A -- import qualified Data.Text as T -- attoparsecReader :: A.Parser a -> ReadM a -- attoparsecReader p = eitherReader (A.parseOnly p . T.pack) --eitherReader :: (String -> Either String a) -> ReadM a -- | Convert a function producing a Maybe into a reader. maybeReader :: (String -> Maybe a) -> ReadM a -- | One or none. optional :: Alternative f => f a -> f (Maybe a) -- | One or more. some :: Alternative f => f a -> f [a] -- | String Option reader. -- -- Polymorphic over the IsString type class since 0.14. str :: IsString s => ReadM s -- | An associative binary operation (<|>) :: Alternative f => f a -> f a -> f a infixl 3 <|> instance GHC.Classes.Eq SimpleCmdArgs.Subcommand instance GHC.Classes.Ord SimpleCmdArgs.Subcommand