diff options
Diffstat (limited to 'Property/Cmd.hs')
| -rw-r--r-- | Property/Cmd.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Property/Cmd.hs b/Property/Cmd.hs new file mode 100644 index 00000000..c78adaeb --- /dev/null +++ b/Property/Cmd.hs @@ -0,0 +1,28 @@ +module Property.Cmd ( + cmdProperty, + cmdProperty', + module Utility.SafeCommand +) where + +import Control.Applicative + +import Property +import Utility.Monad +import Utility.SafeCommand +import Utility.Env + +cmdProperty :: String -> [CommandParam] -> Property +cmdProperty cmd params = cmdProperty' cmd params [] + +cmdProperty' :: String -> [CommandParam] -> [(String, String)] -> Property +cmdProperty' cmd params env = Property desc $ do + env' <- addEntries env <$> getEnvironment + ifM (boolSystemEnv cmd params (Just env')) + ( return MadeChange + , return FailedChange + ) + where + desc = unwords $ cmd : map showp params + showp (Params s) = s + showp (Param s) = s + showp (File s) = s |
