cli-extras 0.2.0.0 → 0.2.1.0
raw patch · 3 files changed
+52/−1 lines, 3 filesdep ~aesondep ~basedep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson, base, containers, lens, logging-effect, mtl, text, transformers
API changes (from Hackage documentation)
+ Cli.Extras.Process: readProc :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadFail m) => ProcessSpec -> m Text
+ Cli.Extras.Process: runProc :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadFail m, MonadMask m) => ProcessSpec -> m ()
+ Cli.Extras.Process: runProcSilently :: (MonadIO m, CliLog m, CliThrow e m, AsProcessFailure e, MonadFail m, MonadMask m) => ProcessSpec -> m ()
Files
- CHANGELOG.md +4/−0
- cli-extras.cabal +1/−1
- src/Cli/Extras/Process.hs +47/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for cli-extras +## 0.2.1.0++* [#7](https://github.com/obsidiansystems/cli-extras/pull/7) add `runProc`, `runProcSilently` and `readProc`.+ ## 0.2.0.0 * [#6](https://github.com/obsidiansystems/cli-extras/pull/6) `cli-extras` now depends on `utf8-string` and `shell-escape`
cli-extras.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: cli-extras-version: 0.2.0.0+version: 0.2.1.0 license: BSD3 license-file: LICENSE copyright: Obsidian Systems LLC 2020-2022
src/Cli/Extras/Process.hs view
@@ -31,6 +31,9 @@ , setEnvOverride , shell , waitForProcess+ , runProc+ , runProcSilently+ , readProc ) where import Control.Monad ((<=<), join, void)@@ -290,3 +293,47 @@ reconstructProcSpec :: ProcessSpec -> Text reconstructProcSpec = reconstructCommand . Process.cmdspec . _processSpec_createProcess++-- | A wrapper for 'callProcessAndLogOutput' with sensible default+-- verbosities: standard output gets the 'Notice' severity and standard+-- error gets 'Error'.+runProc+ :: ( MonadIO m+ , CliLog m+ , CliThrow e m+ , AsProcessFailure e+ , MonadFail m+ , MonadMask m+ )+ => ProcessSpec -> m ()+runProc = callProcessAndLogOutput (Notice, Error)++-- | Like 'runProc', but the child process' output and error streams get+-- the 'Debug' severity.+runProcSilently+ :: ( MonadIO m+ , CliLog m+ , CliThrow e m+ , AsProcessFailure e+ , MonadFail m+ , MonadMask m+ )+ => ProcessSpec -> m ()+runProcSilently = callProcessAndLogOutput (Debug, Debug)++-- | A wrapper for 'readProcessAndLogOutput' with sensible default+-- verbosities: standard output gets the 'Debug' severity and standard+-- error gets 'Error'.+--+-- The child process' output gets the 'Debug' severity rather than the+-- 'Notice' severity because it is first and foremost /returned by this+-- function/, so you can log it afterwards in a reasonable manner.+readProc+ :: ( MonadIO m+ , CliLog m+ , CliThrow e m+ , AsProcessFailure e+ , MonadFail m+ )+ => ProcessSpec -> m Text+readProc = readProcessAndLogOutput (Debug, Error)