-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A threaded manager for Haskell that can run and stream external process output/err/exits -- -- Please see the README on Github at -- https://github.com/loganmac/shellout#readme @package shellout @version 0.1.0.0 -- | Shell is a threaded manager that can run external processes and call -- functions of the Driver on process outputerrexit. module Shellout -- | Driver is a collection of functions that describe what to do on -- process output data Driver a Driver :: (Text -> a) -> (a -> IO a) -> (a -> Text -> IO a) -> (a -> Text -> IO a) -> (a -> IO ()) -> (a -> IO ()) -> Driver a -- | (optionally) do something with the task name, and initialize data that -- will be passed between your handlers. you could store things like the -- task name, a spinner's position and last spin time, etc. [initialState] :: Driver a -> Text -> a -- | what to do when polling returns Nothing, so it's waiting on -- more output from the task, but the task still hasn't exited. usually -- it's sleep. [handleNothing] :: Driver a -> a -> IO a -- | what to do on stdout from the shell command. You could colorize it, -- append it to list of output (you could keep a list in the a), -- etc. [handleOut] :: Driver a -> a -> Text -> IO a -- | what to do on stderr. Same things go as stdout. [handleErr] :: Driver a -> a -> Text -> IO a -- | what to do when a task completes successfully [handleSuccess] :: Driver a -> a -> IO () -- | what to do when a task doesn't complete successfully [handleFailure] :: Driver a -> a -> IO () -- | Shell takes a task name and an external command and executes the given -- callbacks in the provided driver type Shell = (TaskName -> Cmd -> IO ()) -- | Task is the description of an external process type TaskName = Text -- | Cmd is the external command like 'cat file.txt' to run type Cmd = Text -- | creates a new processor to run external processes in, spawns a thread -- to run the processor loop, then returns a Shell that can send -- commands to the processor loop, and react to them with functions from -- the Driver new :: Driver a -> IO Shell