Safe Haskell | Safe-Infered |
---|
Support for changing the output of a lazyCommand in several ways:
- Output a dot for every 128 characters of the original output
- Increase the quietness level before running the command
- Output only if (and when) the command fails
- Throw an exception if the command fails
- No output
- data ProgressFlag
- = Echo
- | Dots
- | All
- | Errors
- | Result
- | EchoOnFail
- | AllOnFail
- | ErrorsOnFail
- | ResultOnFail
- | ExceptionOnFail
- lazyCommandP :: MonadIO m => String -> ByteString -> Set ProgressFlag -> m [Output]
- lazyProcessP :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> Set ProgressFlag -> m [Output]
- timeTask :: MonadIO m => m a -> m (a, NominalDiffTime)
- showElapsed :: MonadIO m => String -> m a -> m a
- tests :: [Test]
- lazyCommandV :: MonadIO m => String -> ByteString -> m [Output]
- lazyProcessV :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]
- lazyCommandF :: MonadIO m => String -> ByteString -> m [Output]
- lazyProcessF :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]
- lazyCommandE :: MonadIO m => String -> ByteString -> m [Output]
- lazyProcessE :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]
- lazyCommandEF :: MonadIO m => String -> ByteString -> m [Output]
- lazyProcessEF :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]
The Progress Monad
data ProgressFlag Source
The flags that control what type of output will be sent to stdout
and stderr. Also, the ExceptionOnFail flag controls whether an
exception will be thrown if the ExitCode
is not ExitSuccess
.
Echo | |
Dots | |
All | |
Errors | |
Result | |
EchoOnFail | If Echo is present this has no effect |
AllOnFail | If All is present this has no effect |
ErrorsOnFail | |
ResultOnFail | |
ExceptionOnFail |
Process launching
lazyCommandP :: MonadIO m => String -> ByteString -> Set ProgressFlag -> m [Output]Source
The P
versions are the most general cases, here you can specify
a function that turns the quietness level into any set of progress
flags you like.
lazyProcessP :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> Set ProgressFlag -> m [Output]Source
timeTask :: MonadIO m => m a -> m (a, NominalDiffTime)Source
Run a task and return the elapsed time along with its result.
showElapsed :: MonadIO m => String -> m a -> m aSource
Perform a task, print the elapsed time it took, and return the result.
Unit tests
A set of lazyCommand functions for an example set of verbosity levels
lazyCommandV :: MonadIO m => String -> ByteString -> m [Output]Source
lazyProcessV :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]Source
lazyCommandF :: MonadIO m => String -> ByteString -> m [Output]Source
lazyProcessF :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]Source
lazyCommandE :: MonadIO m => String -> ByteString -> m [Output]Source
lazyProcessE :: MonadIO m => FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> ByteString -> m [Output]Source
lazyCommandEF :: MonadIO m => String -> ByteString -> m [Output]Source