diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-11 19:33:54 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-01-11 21:55:28 +0100 |
commit | 17998a5e8d386b58d30d138ea8dbc565955cccc6 (patch) | |
tree | 3bad48996590b33c1d64557b31a4fca8221eca18 /src/Command.hs | |
parent | 61a9e98239cf01e91ca079ef176602efe0077dde (diff) |
Concurrently run jobs for multiple commits
Changelog: Concurrently run jobs for multiple commits
Diffstat (limited to 'src/Command.hs')
-rw-r--r-- | src/Command.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Command.hs b/src/Command.hs index 2c2235f..c602ba8 100644 --- a/src/Command.hs +++ b/src/Command.hs @@ -6,8 +6,10 @@ module Command ( CommandArgumentsType(..), CommandExec(..), + CommandInput(..), getCommonOptions, getConfig, + getTerminalOutput, ) where import Control.Monad.Except @@ -20,6 +22,7 @@ import Data.Text qualified as T import System.Console.GetOpt import Config +import Terminal data CommonOptions = CommonOptions { optJobs :: Int @@ -67,11 +70,20 @@ instance CommandArgumentsType (Maybe Text) where argsFromStrings _ = throwError "expected at most one argument" -newtype CommandExec a = CommandExec (ReaderT ( CommonOptions, Config ) IO a) +newtype CommandExec a = CommandExec (ReaderT CommandInput IO a) deriving (Functor, Applicative, Monad, MonadIO) +data CommandInput = CommandInput + { ciOptions :: CommonOptions + , ciConfig :: Config + , ciTerminalOutput :: TerminalOutput + } + getCommonOptions :: CommandExec CommonOptions -getCommonOptions = CommandExec (asks fst) +getCommonOptions = CommandExec (asks ciOptions) getConfig :: CommandExec Config -getConfig = CommandExec (asks snd) +getConfig = CommandExec (asks ciConfig) + +getTerminalOutput :: CommandExec TerminalOutput +getTerminalOutput = CommandExec (asks ciTerminalOutput) |