butcher-1.2.1.0: Chops a command or program invocation into digestable pieces.

Safe HaskellNone
LanguageHaskell2010

UI.Butcher.Monadic.IO

Description

Turn your CmdParser into an IO () to be used as your program main.

Synopsis

Documentation

mainFromCmdParser :: CmdParser Identity (IO ()) () -> IO () Source #

Utility method that allows using a CmdParser as your main function:

main = mainFromCmdParser $ do
  addCmdImpl $ putStrLn "This is a fairly boring program."

Uses System.Environment.getProgName as program name and System.Environment.getArgs as the input to be parsed. Prints some appropriate messages if parsing fails or if the command has no implementation; if all is well executes the 'out' action (the IO ()).

mainFromCmdParserWithHelpDesc :: (CommandDesc () -> CmdParser Identity (IO ()) ()) -> IO () Source #

Same as mainFromCmdParser, but with one additional twist: You get access to a knot-tied complete CommandDesc for this full command. Useful in combination with addHelpCommand