diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-30 15:31:57 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-30 15:38:08 -0400 |
| commit | 90efcd3203d64c2c5691e30ccc23307aae8d20c8 (patch) | |
| tree | 183f38a857a81a3cb1a301b94f827f8a807dc961 /Property/Cmd.hs | |
| parent | 8d31a6226ac9e1dfc75ec7521f039a43e749ed82 (diff) | |
refactor
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 |
