-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simple interface to optparse-applicative
--   
--   Simple interface to optparse-applicative
@package optparse-simple
@version 0.0.3


-- | Simple interface to program arguments.
--   
--   Typical usage with no commands:
--   
--   <pre>
--   do (opts,()) &lt;-
--        simpleOptions "ver"
--                      "header"
--                      "desc"
--                      (flag () () (long "some-flag"))
--                      empty
--      doThings opts
--   </pre>
--   
--   Typical usage with commands:
--   
--   <pre>
--   do (opts,runCmd) &lt;-
--        simpleOptions "ver"
--                      "header"
--                      "desc"
--                      (pure ()) $
--        do addCommand "delete"
--                      "Delete the thing"
--                      (const deleteTheThing)
--                      (pure ())
--           addCommand "create"
--                      "Create a thing"
--                      createAThing
--                      (strOption (long "hello"))
--      runCmd
--   </pre>
module Options.Applicative.Simple

-- | Generate and execute a simple options parser.
simpleOptions :: String -> String -> String -> Parser a -> EitherT b (Writer (Mod CommandFields b)) () -> IO (a, b)

-- | Generate a string like <tt>Version 1.2, Git revision 1234</tt>.
--   
--   <tt>$(simpleVersion …)</tt> <tt>::</tt> <a>String</a>
simpleVersion :: Version -> Q Exp

-- | Add a command to the options dispatcher.
addCommand :: String -> String -> (a -> b) -> Parser a -> EitherT b (Writer (Mod CommandFields b)) ()

-- | Add a command that takes sub-commands to the options dispatcher.
--   
--   Example:
--   
--   <pre>
--   addSubCommands "thing"
--                  "Subcommands that operate on things"
--                  (do addCommand "delete"
--                                 "Delete the thing"
--                                 (const deleteTheThing)
--                                 (pure ())
--                      addCommand "create"
--                                 "Create a thing"
--                                 createAThing
--                                 (strOption (long "hello")))
--   </pre>
--   
--   If there are common options between all the sub-commands, use
--   <a>addCommand</a> in combination with <a>simpleParser</a> instead of
--   <a>addSubCommands</a>.
addSubCommands :: String -> String -> EitherT b (Writer (Mod CommandFields b)) () -> EitherT b (Writer (Mod CommandFields b)) ()

-- | Generate a simple options parser.
--   
--   Most of the time you should use <a>simpleOptions</a> instead, but
--   <a>simpleParser</a> can be used for sub-commands that need common
--   options. For example:
--   
--   <pre>
--   addCommand "thing"
--              "Subcommands that operate on things"
--              (\(opts,runSubCmd) -&gt; runSubCmd opts)
--              (simpleParser (flag () () (long "some-flag")) $
--               do addCommand "delete"
--                             "Delete the thing"
--                             (const deleteTheThing)
--                             (pure ())
--                  addCommand "create"
--                             "Create a thing"
--                             createAThing
--                             (strOption (long "hello")))
--   </pre>
simpleParser :: Parser a -> EitherT b (Writer (Mod CommandFields b)) () -> Parser (a, b)
