{-# LANGUAGE DeriveDataTypeable #-}

-- | Definition of 'Script' and functions to convert 'Script's to bash
--    scripts.
module B9.ShellScript
  ( writeSh,
    renderScript,
    emptyScript,
    CmdVerbosity (..),
    Cwd (..),
    User (..),
    Script (..),
  )
where

import Control.Monad.Reader
import Control.Parallel.Strategies
import Data.Binary
import Data.Data
import Data.Hashable
import Data.List (intercalate)
import Data.Semigroup as Sem
import GHC.Generics (Generic)
import System.Directory
  ( getPermissions,
    setOwnerExecutable,
    setPermissions,
  )

data Script
  = In
      FilePath
      [Script]
  | As
      String
      [Script]
  | IgnoreErrors
      Bool
      [Script]
  | Verbosity
      CmdVerbosity
      [Script]
  | Begin [Script]
  | Run
      FilePath
      [String]
  | NoOP
  deriving (Int -> Script -> ShowS
[Script] -> ShowS
Script -> String
(Int -> Script -> ShowS)
-> (Script -> String) -> ([Script] -> ShowS) -> Show Script
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Script] -> ShowS
$cshowList :: [Script] -> ShowS
show :: Script -> String
$cshow :: Script -> String
showsPrec :: Int -> Script -> ShowS
$cshowsPrec :: Int -> Script -> ShowS
Show, ReadPrec [Script]
ReadPrec Script
Int -> ReadS Script
ReadS [Script]
(Int -> ReadS Script)
-> ReadS [Script]
-> ReadPrec Script
-> ReadPrec [Script]
-> Read Script
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Script]
$creadListPrec :: ReadPrec [Script]
readPrec :: ReadPrec Script
$creadPrec :: ReadPrec Script
readList :: ReadS [Script]
$creadList :: ReadS [Script]
readsPrec :: Int -> ReadS Script
$creadsPrec :: Int -> ReadS Script
Read, Typeable, Typeable Script
DataType
Constr
Typeable Script
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Script -> c Script)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Script)
-> (Script -> Constr)
-> (Script -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Script))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Script))
-> ((forall b. Data b => b -> b) -> Script -> Script)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Script -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Script -> r)
-> (forall u. (forall d. Data d => d -> u) -> Script -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Script -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Script -> m Script)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Script -> m Script)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Script -> m Script)
-> Data Script
Script -> DataType
Script -> Constr
(forall b. Data b => b -> b) -> Script -> Script
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Script -> c Script
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Script
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Script -> u
forall u. (forall d. Data d => d -> u) -> Script -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Script -> m Script
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Script -> m Script
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Script
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Script -> c Script
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Script)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Script)
$cNoOP :: Constr
$cRun :: Constr
$cBegin :: Constr
$cVerbosity :: Constr
$cIgnoreErrors :: Constr
$cAs :: Constr
$cIn :: Constr
$tScript :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Script -> m Script
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Script -> m Script
gmapMp :: (forall d. Data d => d -> m d) -> Script -> m Script
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Script -> m Script
gmapM :: (forall d. Data d => d -> m d) -> Script -> m Script
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Script -> m Script
gmapQi :: Int -> (forall d. Data d => d -> u) -> Script -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Script -> u
gmapQ :: (forall d. Data d => d -> u) -> Script -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Script -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Script -> r
gmapT :: (forall b. Data b => b -> b) -> Script -> Script
$cgmapT :: (forall b. Data b => b -> b) -> Script -> Script
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Script)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Script)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Script)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Script)
dataTypeOf :: Script -> DataType
$cdataTypeOf :: Script -> DataType
toConstr :: Script -> Constr
$ctoConstr :: Script -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Script
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Script
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Script -> c Script
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Script -> c Script
$cp1Data :: Typeable Script
Data, Script -> Script -> Bool
(Script -> Script -> Bool)
-> (Script -> Script -> Bool) -> Eq Script
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Script -> Script -> Bool
$c/= :: Script -> Script -> Bool
== :: Script -> Script -> Bool
$c== :: Script -> Script -> Bool
Eq, (forall x. Script -> Rep Script x)
-> (forall x. Rep Script x -> Script) -> Generic Script
forall x. Rep Script x -> Script
forall x. Script -> Rep Script x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Script x -> Script
$cfrom :: forall x. Script -> Rep Script x
Generic)

instance Hashable Script

instance Binary Script

instance NFData Script

instance Sem.Semigroup Script where
  Script
NoOP <> :: Script -> Script -> Script
<> Script
s = Script
s
  Script
s <> Script
NoOP = Script
s
  (Begin [Script]
ss) <> (Begin [Script]
ss') = [Script] -> Script
Begin ([Script]
ss [Script] -> [Script] -> [Script]
forall a. [a] -> [a] -> [a]
++ [Script]
ss')
  (Begin [Script]
ss) <> Script
s' = [Script] -> Script
Begin ([Script]
ss [Script] -> [Script] -> [Script]
forall a. [a] -> [a] -> [a]
++ [Script
s'])
  Script
s <> (Begin [Script]
ss') = [Script] -> Script
Begin (Script
s Script -> [Script] -> [Script]
forall a. a -> [a] -> [a]
: [Script]
ss')
  Script
s <> Script
s' = [Script] -> Script
Begin [Script
s, Script
s']

instance Monoid Script where
  mempty :: Script
mempty = Script
NoOP
  mappend :: Script -> Script -> Script
mappend = Script -> Script -> Script
forall a. Semigroup a => a -> a -> a
(Sem.<>)

data Cmd
  = Cmd
      String
      [String]
      User
      Cwd
      Bool
      CmdVerbosity
  deriving (Int -> Cmd -> ShowS
[Cmd] -> ShowS
Cmd -> String
(Int -> Cmd -> ShowS)
-> (Cmd -> String) -> ([Cmd] -> ShowS) -> Show Cmd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cmd] -> ShowS
$cshowList :: [Cmd] -> ShowS
show :: Cmd -> String
$cshow :: Cmd -> String
showsPrec :: Int -> Cmd -> ShowS
$cshowsPrec :: Int -> Cmd -> ShowS
Show, ReadPrec [Cmd]
ReadPrec Cmd
Int -> ReadS Cmd
ReadS [Cmd]
(Int -> ReadS Cmd)
-> ReadS [Cmd] -> ReadPrec Cmd -> ReadPrec [Cmd] -> Read Cmd
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Cmd]
$creadListPrec :: ReadPrec [Cmd]
readPrec :: ReadPrec Cmd
$creadPrec :: ReadPrec Cmd
readList :: ReadS [Cmd]
$creadList :: ReadS [Cmd]
readsPrec :: Int -> ReadS Cmd
$creadsPrec :: Int -> ReadS Cmd
Read, Typeable, Typeable Cmd
DataType
Constr
Typeable Cmd
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Cmd -> c Cmd)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Cmd)
-> (Cmd -> Constr)
-> (Cmd -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Cmd))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cmd))
-> ((forall b. Data b => b -> b) -> Cmd -> Cmd)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r)
-> (forall u. (forall d. Data d => d -> u) -> Cmd -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Cmd -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Cmd -> m Cmd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cmd -> m Cmd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cmd -> m Cmd)
-> Data Cmd
Cmd -> DataType
Cmd -> Constr
(forall b. Data b => b -> b) -> Cmd -> Cmd
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cmd -> c Cmd
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cmd
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Cmd -> u
forall u. (forall d. Data d => d -> u) -> Cmd -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cmd -> m Cmd
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cmd -> m Cmd
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cmd
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cmd -> c Cmd
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cmd)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cmd)
$cCmd :: Constr
$tCmd :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Cmd -> m Cmd
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cmd -> m Cmd
gmapMp :: (forall d. Data d => d -> m d) -> Cmd -> m Cmd
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cmd -> m Cmd
gmapM :: (forall d. Data d => d -> m d) -> Cmd -> m Cmd
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cmd -> m Cmd
gmapQi :: Int -> (forall d. Data d => d -> u) -> Cmd -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Cmd -> u
gmapQ :: (forall d. Data d => d -> u) -> Cmd -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Cmd -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cmd -> r
gmapT :: (forall b. Data b => b -> b) -> Cmd -> Cmd
$cgmapT :: (forall b. Data b => b -> b) -> Cmd -> Cmd
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cmd)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cmd)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Cmd)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cmd)
dataTypeOf :: Cmd -> DataType
$cdataTypeOf :: Cmd -> DataType
toConstr :: Cmd -> Constr
$ctoConstr :: Cmd -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cmd
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cmd
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cmd -> c Cmd
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cmd -> c Cmd
$cp1Data :: Typeable Cmd
Data, Cmd -> Cmd -> Bool
(Cmd -> Cmd -> Bool) -> (Cmd -> Cmd -> Bool) -> Eq Cmd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cmd -> Cmd -> Bool
$c/= :: Cmd -> Cmd -> Bool
== :: Cmd -> Cmd -> Bool
$c== :: Cmd -> Cmd -> Bool
Eq, (forall x. Cmd -> Rep Cmd x)
-> (forall x. Rep Cmd x -> Cmd) -> Generic Cmd
forall x. Rep Cmd x -> Cmd
forall x. Cmd -> Rep Cmd x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cmd x -> Cmd
$cfrom :: forall x. Cmd -> Rep Cmd x
Generic)

instance Hashable Cmd

instance Binary Cmd

instance NFData Cmd

data CmdVerbosity
  = Debug
  | Verbose
  | OnlyStdErr
  | Quiet
  deriving (Int -> CmdVerbosity -> ShowS
[CmdVerbosity] -> ShowS
CmdVerbosity -> String
(Int -> CmdVerbosity -> ShowS)
-> (CmdVerbosity -> String)
-> ([CmdVerbosity] -> ShowS)
-> Show CmdVerbosity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmdVerbosity] -> ShowS
$cshowList :: [CmdVerbosity] -> ShowS
show :: CmdVerbosity -> String
$cshow :: CmdVerbosity -> String
showsPrec :: Int -> CmdVerbosity -> ShowS
$cshowsPrec :: Int -> CmdVerbosity -> ShowS
Show, ReadPrec [CmdVerbosity]
ReadPrec CmdVerbosity
Int -> ReadS CmdVerbosity
ReadS [CmdVerbosity]
(Int -> ReadS CmdVerbosity)
-> ReadS [CmdVerbosity]
-> ReadPrec CmdVerbosity
-> ReadPrec [CmdVerbosity]
-> Read CmdVerbosity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmdVerbosity]
$creadListPrec :: ReadPrec [CmdVerbosity]
readPrec :: ReadPrec CmdVerbosity
$creadPrec :: ReadPrec CmdVerbosity
readList :: ReadS [CmdVerbosity]
$creadList :: ReadS [CmdVerbosity]
readsPrec :: Int -> ReadS CmdVerbosity
$creadsPrec :: Int -> ReadS CmdVerbosity
Read, Typeable, Typeable CmdVerbosity
DataType
Constr
Typeable CmdVerbosity
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CmdVerbosity -> c CmdVerbosity)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CmdVerbosity)
-> (CmdVerbosity -> Constr)
-> (CmdVerbosity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CmdVerbosity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CmdVerbosity))
-> ((forall b. Data b => b -> b) -> CmdVerbosity -> CmdVerbosity)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r)
-> (forall u. (forall d. Data d => d -> u) -> CmdVerbosity -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CmdVerbosity -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity)
-> Data CmdVerbosity
CmdVerbosity -> DataType
CmdVerbosity -> Constr
(forall b. Data b => b -> b) -> CmdVerbosity -> CmdVerbosity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CmdVerbosity -> c CmdVerbosity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CmdVerbosity
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CmdVerbosity -> u
forall u. (forall d. Data d => d -> u) -> CmdVerbosity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CmdVerbosity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CmdVerbosity -> c CmdVerbosity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CmdVerbosity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CmdVerbosity)
$cQuiet :: Constr
$cOnlyStdErr :: Constr
$cVerbose :: Constr
$cDebug :: Constr
$tCmdVerbosity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
gmapMp :: (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
gmapM :: (forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CmdVerbosity -> m CmdVerbosity
gmapQi :: Int -> (forall d. Data d => d -> u) -> CmdVerbosity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CmdVerbosity -> u
gmapQ :: (forall d. Data d => d -> u) -> CmdVerbosity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CmdVerbosity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CmdVerbosity -> r
gmapT :: (forall b. Data b => b -> b) -> CmdVerbosity -> CmdVerbosity
$cgmapT :: (forall b. Data b => b -> b) -> CmdVerbosity -> CmdVerbosity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CmdVerbosity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CmdVerbosity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CmdVerbosity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CmdVerbosity)
dataTypeOf :: CmdVerbosity -> DataType
$cdataTypeOf :: CmdVerbosity -> DataType
toConstr :: CmdVerbosity -> Constr
$ctoConstr :: CmdVerbosity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CmdVerbosity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CmdVerbosity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CmdVerbosity -> c CmdVerbosity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CmdVerbosity -> c CmdVerbosity
$cp1Data :: Typeable CmdVerbosity
Data, CmdVerbosity -> CmdVerbosity -> Bool
(CmdVerbosity -> CmdVerbosity -> Bool)
-> (CmdVerbosity -> CmdVerbosity -> Bool) -> Eq CmdVerbosity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmdVerbosity -> CmdVerbosity -> Bool
$c/= :: CmdVerbosity -> CmdVerbosity -> Bool
== :: CmdVerbosity -> CmdVerbosity -> Bool
$c== :: CmdVerbosity -> CmdVerbosity -> Bool
Eq, (forall x. CmdVerbosity -> Rep CmdVerbosity x)
-> (forall x. Rep CmdVerbosity x -> CmdVerbosity)
-> Generic CmdVerbosity
forall x. Rep CmdVerbosity x -> CmdVerbosity
forall x. CmdVerbosity -> Rep CmdVerbosity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CmdVerbosity x -> CmdVerbosity
$cfrom :: forall x. CmdVerbosity -> Rep CmdVerbosity x
Generic)

instance Hashable CmdVerbosity

instance Binary CmdVerbosity

instance NFData CmdVerbosity

data Cwd
  = Cwd FilePath
  | NoCwd
  deriving (Int -> Cwd -> ShowS
[Cwd] -> ShowS
Cwd -> String
(Int -> Cwd -> ShowS)
-> (Cwd -> String) -> ([Cwd] -> ShowS) -> Show Cwd
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Cwd] -> ShowS
$cshowList :: [Cwd] -> ShowS
show :: Cwd -> String
$cshow :: Cwd -> String
showsPrec :: Int -> Cwd -> ShowS
$cshowsPrec :: Int -> Cwd -> ShowS
Show, ReadPrec [Cwd]
ReadPrec Cwd
Int -> ReadS Cwd
ReadS [Cwd]
(Int -> ReadS Cwd)
-> ReadS [Cwd] -> ReadPrec Cwd -> ReadPrec [Cwd] -> Read Cwd
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Cwd]
$creadListPrec :: ReadPrec [Cwd]
readPrec :: ReadPrec Cwd
$creadPrec :: ReadPrec Cwd
readList :: ReadS [Cwd]
$creadList :: ReadS [Cwd]
readsPrec :: Int -> ReadS Cwd
$creadsPrec :: Int -> ReadS Cwd
Read, Typeable, Typeable Cwd
DataType
Constr
Typeable Cwd
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Cwd -> c Cwd)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Cwd)
-> (Cwd -> Constr)
-> (Cwd -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Cwd))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cwd))
-> ((forall b. Data b => b -> b) -> Cwd -> Cwd)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r)
-> (forall u. (forall d. Data d => d -> u) -> Cwd -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Cwd -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Cwd -> m Cwd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cwd -> m Cwd)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Cwd -> m Cwd)
-> Data Cwd
Cwd -> DataType
Cwd -> Constr
(forall b. Data b => b -> b) -> Cwd -> Cwd
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cwd -> c Cwd
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cwd
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Cwd -> u
forall u. (forall d. Data d => d -> u) -> Cwd -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cwd -> m Cwd
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cwd -> m Cwd
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cwd
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cwd -> c Cwd
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cwd)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cwd)
$cNoCwd :: Constr
$cCwd :: Constr
$tCwd :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Cwd -> m Cwd
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cwd -> m Cwd
gmapMp :: (forall d. Data d => d -> m d) -> Cwd -> m Cwd
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Cwd -> m Cwd
gmapM :: (forall d. Data d => d -> m d) -> Cwd -> m Cwd
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Cwd -> m Cwd
gmapQi :: Int -> (forall d. Data d => d -> u) -> Cwd -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Cwd -> u
gmapQ :: (forall d. Data d => d -> u) -> Cwd -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Cwd -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cwd -> r
gmapT :: (forall b. Data b => b -> b) -> Cwd -> Cwd
$cgmapT :: (forall b. Data b => b -> b) -> Cwd -> Cwd
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cwd)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cwd)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Cwd)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Cwd)
dataTypeOf :: Cwd -> DataType
$cdataTypeOf :: Cwd -> DataType
toConstr :: Cwd -> Constr
$ctoConstr :: Cwd -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cwd
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Cwd
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cwd -> c Cwd
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Cwd -> c Cwd
$cp1Data :: Typeable Cwd
Data, Cwd -> Cwd -> Bool
(Cwd -> Cwd -> Bool) -> (Cwd -> Cwd -> Bool) -> Eq Cwd
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Cwd -> Cwd -> Bool
$c/= :: Cwd -> Cwd -> Bool
== :: Cwd -> Cwd -> Bool
$c== :: Cwd -> Cwd -> Bool
Eq, (forall x. Cwd -> Rep Cwd x)
-> (forall x. Rep Cwd x -> Cwd) -> Generic Cwd
forall x. Rep Cwd x -> Cwd
forall x. Cwd -> Rep Cwd x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Cwd x -> Cwd
$cfrom :: forall x. Cwd -> Rep Cwd x
Generic)

instance Hashable Cwd

instance Binary Cwd

instance NFData Cwd

data User
  = User String
  | NoUser
  deriving (Int -> User -> ShowS
[User] -> ShowS
User -> String
(Int -> User -> ShowS)
-> (User -> String) -> ([User] -> ShowS) -> Show User
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Show, ReadPrec [User]
ReadPrec User
Int -> ReadS User
ReadS [User]
(Int -> ReadS User)
-> ReadS [User] -> ReadPrec User -> ReadPrec [User] -> Read User
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [User]
$creadListPrec :: ReadPrec [User]
readPrec :: ReadPrec User
$creadPrec :: ReadPrec User
readList :: ReadS [User]
$creadList :: ReadS [User]
readsPrec :: Int -> ReadS User
$creadsPrec :: Int -> ReadS User
Read, Typeable, Typeable User
DataType
Constr
Typeable User
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> User -> c User)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c User)
-> (User -> Constr)
-> (User -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c User))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c User))
-> ((forall b. Data b => b -> b) -> User -> User)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> User -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> User -> r)
-> (forall u. (forall d. Data d => d -> u) -> User -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> User -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> User -> m User)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> User -> m User)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> User -> m User)
-> Data User
User -> DataType
User -> Constr
(forall b. Data b => b -> b) -> User -> User
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> User -> c User
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c User
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> User -> u
forall u. (forall d. Data d => d -> u) -> User -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> User -> m User
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> User -> m User
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c User
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> User -> c User
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c User)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c User)
$cNoUser :: Constr
$cUser :: Constr
$tUser :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> User -> m User
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> User -> m User
gmapMp :: (forall d. Data d => d -> m d) -> User -> m User
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> User -> m User
gmapM :: (forall d. Data d => d -> m d) -> User -> m User
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> User -> m User
gmapQi :: Int -> (forall d. Data d => d -> u) -> User -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> User -> u
gmapQ :: (forall d. Data d => d -> u) -> User -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> User -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> User -> r
gmapT :: (forall b. Data b => b -> b) -> User -> User
$cgmapT :: (forall b. Data b => b -> b) -> User -> User
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c User)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c User)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c User)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c User)
dataTypeOf :: User -> DataType
$cdataTypeOf :: User -> DataType
toConstr :: User -> Constr
$ctoConstr :: User -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c User
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c User
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> User -> c User
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> User -> c User
$cp1Data :: Typeable User
Data, User -> User -> Bool
(User -> User -> Bool) -> (User -> User -> Bool) -> Eq User
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: User -> User -> Bool
$c/= :: User -> User -> Bool
== :: User -> User -> Bool
$c== :: User -> User -> Bool
Eq, (forall x. User -> Rep User x)
-> (forall x. Rep User x -> User) -> Generic User
forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Generic)

instance Hashable User

instance Binary User

instance NFData User

data Ctx
  = Ctx
      { Ctx -> Cwd
ctxCwd :: Cwd,
        Ctx -> User
ctxUser :: User,
        Ctx -> Bool
ctxIgnoreErrors :: Bool,
        Ctx -> CmdVerbosity
ctxVerbosity :: CmdVerbosity
      }
  deriving (Int -> Ctx -> ShowS
[Ctx] -> ShowS
Ctx -> String
(Int -> Ctx -> ShowS)
-> (Ctx -> String) -> ([Ctx] -> ShowS) -> Show Ctx
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Ctx] -> ShowS
$cshowList :: [Ctx] -> ShowS
show :: Ctx -> String
$cshow :: Ctx -> String
showsPrec :: Int -> Ctx -> ShowS
$cshowsPrec :: Int -> Ctx -> ShowS
Show, ReadPrec [Ctx]
ReadPrec Ctx
Int -> ReadS Ctx
ReadS [Ctx]
(Int -> ReadS Ctx)
-> ReadS [Ctx] -> ReadPrec Ctx -> ReadPrec [Ctx] -> Read Ctx
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Ctx]
$creadListPrec :: ReadPrec [Ctx]
readPrec :: ReadPrec Ctx
$creadPrec :: ReadPrec Ctx
readList :: ReadS [Ctx]
$creadList :: ReadS [Ctx]
readsPrec :: Int -> ReadS Ctx
$creadsPrec :: Int -> ReadS Ctx
Read, Typeable, Typeable Ctx
DataType
Constr
Typeable Ctx
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Ctx -> c Ctx)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Ctx)
-> (Ctx -> Constr)
-> (Ctx -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Ctx))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ctx))
-> ((forall b. Data b => b -> b) -> Ctx -> Ctx)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r)
-> (forall u. (forall d. Data d => d -> u) -> Ctx -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Ctx -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Ctx -> m Ctx)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Ctx -> m Ctx)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Ctx -> m Ctx)
-> Data Ctx
Ctx -> DataType
Ctx -> Constr
(forall b. Data b => b -> b) -> Ctx -> Ctx
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ctx -> c Ctx
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Ctx
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Ctx -> u
forall u. (forall d. Data d => d -> u) -> Ctx -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Ctx -> m Ctx
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Ctx -> m Ctx
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Ctx
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ctx -> c Ctx
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Ctx)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ctx)
$cCtx :: Constr
$tCtx :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Ctx -> m Ctx
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Ctx -> m Ctx
gmapMp :: (forall d. Data d => d -> m d) -> Ctx -> m Ctx
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Ctx -> m Ctx
gmapM :: (forall d. Data d => d -> m d) -> Ctx -> m Ctx
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Ctx -> m Ctx
gmapQi :: Int -> (forall d. Data d => d -> u) -> Ctx -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Ctx -> u
gmapQ :: (forall d. Data d => d -> u) -> Ctx -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Ctx -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Ctx -> r
gmapT :: (forall b. Data b => b -> b) -> Ctx -> Ctx
$cgmapT :: (forall b. Data b => b -> b) -> Ctx -> Ctx
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ctx)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Ctx)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Ctx)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Ctx)
dataTypeOf :: Ctx -> DataType
$cdataTypeOf :: Ctx -> DataType
toConstr :: Ctx -> Constr
$ctoConstr :: Ctx -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Ctx
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Ctx
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ctx -> c Ctx
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Ctx -> c Ctx
$cp1Data :: Typeable Ctx
Data, Ctx -> Ctx -> Bool
(Ctx -> Ctx -> Bool) -> (Ctx -> Ctx -> Bool) -> Eq Ctx
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Ctx -> Ctx -> Bool
$c/= :: Ctx -> Ctx -> Bool
== :: Ctx -> Ctx -> Bool
$c== :: Ctx -> Ctx -> Bool
Eq, (forall x. Ctx -> Rep Ctx x)
-> (forall x. Rep Ctx x -> Ctx) -> Generic Ctx
forall x. Rep Ctx x -> Ctx
forall x. Ctx -> Rep Ctx x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Ctx x -> Ctx
$cfrom :: forall x. Ctx -> Rep Ctx x
Generic)

instance Hashable Ctx

instance Binary Ctx

instance NFData Ctx

-- | Convert 'script' to bash-shell-script written to 'file' and make 'file'
-- executable.
writeSh :: FilePath -> Script -> IO ()
writeSh :: String -> Script -> IO ()
writeSh String
file Script
script = do
  String -> String -> IO ()
writeFile String
file ([Cmd] -> String
toBash ([Cmd] -> String) -> [Cmd] -> String
forall a b. (a -> b) -> a -> b
$ Script -> [Cmd]
toCmds Script
script)
  String -> IO Permissions
getPermissions String
file IO Permissions -> (Permissions -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= String -> Permissions -> IO ()
setPermissions String
file (Permissions -> IO ())
-> (Permissions -> Permissions) -> Permissions -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Permissions -> Permissions
setOwnerExecutable Bool
True

-- | Check if a script has the same effect as 'NoOP'
emptyScript :: Script -> Bool
emptyScript :: Script -> Bool
emptyScript = [Cmd] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null ([Cmd] -> Bool) -> (Script -> [Cmd]) -> Script -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Script -> [Cmd]
toCmds

toCmds :: Script -> [Cmd]
toCmds :: Script -> [Cmd]
toCmds Script
s = Reader Ctx [Cmd] -> Ctx -> [Cmd]
forall r a. Reader r a -> r -> a
runReader (Script -> Reader Ctx [Cmd]
toLLC Script
s) (Cwd -> User -> Bool -> CmdVerbosity -> Ctx
Ctx Cwd
NoCwd User
NoUser Bool
False CmdVerbosity
Debug)
  where
    toLLC :: Script -> Reader Ctx [Cmd]
    toLLC :: Script -> Reader Ctx [Cmd]
toLLC Script
NoOP = [Cmd] -> Reader Ctx [Cmd]
forall (m :: * -> *) a. Monad m => a -> m a
return []
    toLLC (In String
d [Script]
cs) = (Ctx -> Ctx) -> Reader Ctx [Cmd] -> Reader Ctx [Cmd]
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (\Ctx
ctx -> Ctx
ctx {ctxCwd :: Cwd
ctxCwd = String -> Cwd
Cwd String
d}) (Script -> Reader Ctx [Cmd]
toLLC ([Script] -> Script
Begin [Script]
cs))
    toLLC (As String
u [Script]
cs) =
      (Ctx -> Ctx) -> Reader Ctx [Cmd] -> Reader Ctx [Cmd]
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (\Ctx
ctx -> Ctx
ctx {ctxUser :: User
ctxUser = String -> User
User String
u}) (Script -> Reader Ctx [Cmd]
toLLC ([Script] -> Script
Begin [Script]
cs))
    toLLC (IgnoreErrors Bool
b [Script]
cs) =
      (Ctx -> Ctx) -> Reader Ctx [Cmd] -> Reader Ctx [Cmd]
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (\Ctx
ctx -> Ctx
ctx {ctxIgnoreErrors :: Bool
ctxIgnoreErrors = Bool
b}) (Script -> Reader Ctx [Cmd]
toLLC ([Script] -> Script
Begin [Script]
cs))
    toLLC (Verbosity CmdVerbosity
v [Script]
cs) =
      (Ctx -> Ctx) -> Reader Ctx [Cmd] -> Reader Ctx [Cmd]
forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local (\Ctx
ctx -> Ctx
ctx {ctxVerbosity :: CmdVerbosity
ctxVerbosity = CmdVerbosity
v}) (Script -> Reader Ctx [Cmd]
toLLC ([Script] -> Script
Begin [Script]
cs))
    toLLC (Begin [Script]
cs) = [[Cmd]] -> [Cmd]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([[Cmd]] -> [Cmd])
-> ReaderT Ctx Identity [[Cmd]] -> Reader Ctx [Cmd]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Script -> Reader Ctx [Cmd])
-> [Script] -> ReaderT Ctx Identity [[Cmd]]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Script -> Reader Ctx [Cmd]
toLLC [Script]
cs
    toLLC (Run String
cmd [String]
args) = do
      Cwd
c <- (Ctx -> Cwd) -> ReaderT Ctx Identity Cwd
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
reader Ctx -> Cwd
ctxCwd
      User
u <- (Ctx -> User) -> ReaderT Ctx Identity User
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
reader Ctx -> User
ctxUser
      Bool
i <- (Ctx -> Bool) -> ReaderT Ctx Identity Bool
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
reader Ctx -> Bool
ctxIgnoreErrors
      CmdVerbosity
v <- (Ctx -> CmdVerbosity) -> ReaderT Ctx Identity CmdVerbosity
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
reader Ctx -> CmdVerbosity
ctxVerbosity
      [Cmd] -> Reader Ctx [Cmd]
forall (m :: * -> *) a. Monad m => a -> m a
return [String -> [String] -> User -> Cwd -> Bool -> CmdVerbosity -> Cmd
Cmd String
cmd [String]
args User
u Cwd
c Bool
i CmdVerbosity
v]

renderScript :: Script -> String
renderScript :: Script -> String
renderScript = [Cmd] -> String
toBash ([Cmd] -> String) -> (Script -> [Cmd]) -> Script -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Script -> [Cmd]
toCmds

toBash :: [Cmd] -> String
toBash :: [Cmd] -> String
toBash [Cmd]
cmds = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ [String]
bashHeader [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ (Cmd -> String
cmdToBash (Cmd -> String) -> [Cmd] -> [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Cmd]
cmds)

bashHeader :: [String]
bashHeader :: [String]
bashHeader = [String
"#!/bin/bash", String
"set -e"]

cmdToBash :: Cmd -> String
cmdToBash :: Cmd -> String
cmdToBash (Cmd String
cmd [String]
args User
user Cwd
cwd Bool
ignoreErrors CmdVerbosity
verbosity) =
  String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
    [String]
disableErrorChecking
      [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Cwd -> [String]
pushd Cwd
cwdQ
      [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
execCmd
      [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Cwd -> [String]
popd Cwd
cwdQ
      [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
reenableErrorChecking
  where
    execCmd :: [String]
execCmd = [[String] -> String
unwords ([String]
runuser [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String
cmd] [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
args [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
redirectOutput)]
      where
        runuser :: [String]
runuser = case User
user of
          User
NoUser -> []
          User String
"root" -> []
          User String
u -> [String
"runuser", String
"-p", String
"-u", String
u, String
"--"]
    pushd :: Cwd -> [String]
pushd Cwd
NoCwd = []
    pushd (Cwd String
cwdPath) = [[String] -> String
unwords ([String
"pushd", String
cwdPath] [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
redirectOutput)]
    popd :: Cwd -> [String]
popd Cwd
NoCwd = []
    popd (Cwd String
cwdPath) =
      [[String] -> String
unwords ([String
"popd"] [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
redirectOutput [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String
"#", String
cwdPath])]
    disableErrorChecking :: [String]
disableErrorChecking = [String
"set +e" | Bool
ignoreErrors]
    reenableErrorChecking :: [String]
reenableErrorChecking = [String
"set -e" | Bool
ignoreErrors]
    cwdQ :: Cwd
cwdQ = case Cwd
cwd of
      Cwd
NoCwd -> Cwd
NoCwd
      Cwd String
d -> String -> Cwd
Cwd (String
"'" String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
d String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"'")
    redirectOutput :: [String]
redirectOutput = case CmdVerbosity
verbosity of
      CmdVerbosity
Debug -> []
      CmdVerbosity
Verbose -> []
      CmdVerbosity
OnlyStdErr -> [String
">", String
"/dev/null"]
      CmdVerbosity
Quiet -> [String
"&>", String
"/dev/null"]