-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Command Line Interface -- -- All you need for interacting with users at the Console level -- -- @package cli @version 0.1.1 module Console.Display data TerminalDisplay displayInit :: IO TerminalDisplay display :: TerminalDisplay -> [OutputElem] -> IO () displayTextColor :: TerminalDisplay -> Color -> String -> IO () displayLn :: TerminalDisplay -> Color -> String -> IO () data ProgressBar progress :: TerminalDisplay -> Int -> (ProgressBar -> IO a) -> IO a progressTick :: ProgressBar -> IO () data Summary summary :: TerminalDisplay -> IO Summary summarySet :: Summary -> [OutputElem] -> IO () data Color :: * Black :: Color Red :: Color Green :: Color Yellow :: Color Blue :: Color Magenta :: Color Cyan :: Color White :: Color ColorNumber :: Int -> Color data OutputElem Bg :: Color -> OutputElem Fg :: Color -> OutputElem T :: String -> OutputElem LeftT :: Int -> String -> OutputElem RightT :: Int -> String -> OutputElem NA :: OutputElem termText :: String -> TermOutput justify :: Justify -> Int -> String -> String data Justify JustifyLeft :: Justify JustifyRight :: Justify data Table data Column columnNew :: Int -> String -> Column tableCreate :: [Column] -> Table tableHeaders :: TerminalDisplay -> Table -> IO () tableAppend :: TerminalDisplay -> Table -> [String] -> IO () instance GHC.Classes.Eq Console.Display.OutputElem instance GHC.Show.Show Console.Display.OutputElem module Console.Options defaultMain :: OptionDesc (IO ()) () -> IO () defaultMainWith :: OptionDesc (IO ()) () -> [String] -> IO () parseOptions :: OptionDesc r () -> [String] -> (ProgramDesc r, OptionRes r) data OptionRes r OptionSuccess :: Params -> (Action r) -> OptionRes r OptionHelp :: OptionRes r OptionError :: String -> OptionRes r OptionInvalid :: String -> OptionRes r data OptionDesc r a -- | Set the program name programName :: String -> OptionDesc r () -- | Set the program version programVersion :: Version -> OptionDesc r () -- | Set the program description programDescription :: String -> OptionDesc r () -- | Create a new sub command command :: String -> OptionDesc r () -> OptionDesc r () data FlagFrag FlagShort :: Char -> FlagFrag FlagLong :: String -> FlagFrag FlagDescription :: String -> FlagFrag -- | Flag option either of the form -short or --long -- -- for flag that expect a value (optional or mandatory), uses -- flagArg flag :: FlagFrag -> OptionDesc r (Flag Bool) -- | Flag option either of the form -short or --long -- -- for flag that doesn't have parameter, use flag flagParam :: FlagFrag -> FlagParser a -> OptionDesc r (FlagParam a) flagMany :: OptionDesc r (FlagParam a) -> OptionDesc r (FlagMany a) -- | give the ability to set options that are conflicting with each other -- if option a is given with option b then an conflicting error happens conflict :: Flag a -> Flag b -> OptionDesc r () -- | An unnamed argument -- -- For now, argument in a point of tree that contains sub trees will be -- ignored. TODO: record a warning or add a strict mode (for developping -- the CLI) and error. argument :: String -> ValueParser a -> OptionDesc r (Arg a) remainingArguments :: String -> OptionDesc r (ArgRemaining [String]) -- | Set the action to run in this command action :: Action r -> OptionDesc r () -- | Set the description for a command description :: String -> OptionDesc r () -- | Represent a program to run type Action r = (forall a p. Param p => p a -> Ret p a) -> r data FlagParser a FlagRequired :: (ValueParser a) -> FlagParser a FlagOptional :: a -> (ValueParser a) -> FlagParser a data Flag a data FlagLevel a data FlagParam a data FlagMany a data Arg a data ArgRemaining a data Params Params :: [(Nid, Maybe String)] -> [String] -> [String] -> Params [paramsFlags] :: Params -> [(Nid, Maybe String)] [paramsPinnedArgs] :: Params -> [String] [paramsRemainingArgs] :: Params -> [String] getParams :: Param p => Params -> (forall a. p a -> Ret p a)