newt 0.0.3.0 → 0.0.3.1
raw patch · 2 files changed
+4/−2 lines, 2 files
Files
- newt.cabal +1/−1
- src/Newt/Outputs.hs +3/−1
newt.cabal view
@@ -1,5 +1,5 @@ name: newt-version: 0.0.3.0+version: 0.0.3.1 synopsis: A trivially simple app to create things from simple templates. description: Instantiates text things from templates. category: Tools
src/Newt/Outputs.hs view
@@ -28,13 +28,15 @@ In.StandardIn -> return $ File pth In.TxtFile _ -> return $ File pth In.Directory _ -> return $ Directory pth+ In.BinFile _ -> return $ File pth -- | Convert an inputspec into an output spec that represents the same -- source. used for inplace modifications. fromInputSpec :: In.InputSpec -> ErrorT String IO OutputSpec fromInputSpec (In.TxtFile file) = return $ File file+fromInputSpec (In.BinFile file) = return $ File file fromInputSpec (In.Directory dir) = return $ Directory dir-fromInputSpec In.StandardIn = throwError "Can not modife stdin inplace."+fromInputSpec In.StandardIn = throwError "Can not modify stdin inplace." writeTo :: OutputSpec -> String -> IO () writeTo (File outFile) str = withTemporaryDirectory "newt-XXXXXX" $ \dir -> do