shelly 0.12.1.1 → 0.12.2
raw patch · 2 files changed
+27/−17 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Shelly: RunFailed :: FilePath -> [Text] -> Int -> Text -> RunFailed
- Shelly: data RunFailed
+ Shelly: hasExt :: Text -> FilePath -> Bool
+ Shelly: touchfile :: FilePath -> ShIO ()
Files
- Shelly.hs +26/−14
- shelly.cabal +1/−3
Shelly.hs view
@@ -32,8 +32,6 @@ , command, command_, command1, command1_ , sshPairs, sshPairs_ --- , Sudo(..), run_sudo- -- * Modifying and querying environment. , setenv, getenv, getenv_def, appendToPath @@ -49,27 +47,30 @@ -- * Filename helpers , absPath, (</>), (<.>), canonic, canonicalize, relPath, relativeTo, path+ , hasExt -- * Manipulating filesystem. , mv, rm, rm_f, rm_rf, cp, cp_r, mkdir, mkdir_p- , readfile, writefile, appendfile, withTmpDir + -- * reading/writing Files+ , readfile, writefile, appendfile, touchfile, withTmpDir+ -- * exiting the program , exit, errorExit, terror - -- * Utilities.- , (<$>), (<$$>), whenM, unlessM+ -- * Exceptions , catchany, catch_sh, finally_sh, ShellyHandler(..), catches_sh, catchany_sh- , time- , RunFailed(..) -- * convert between Text and FilePath , toTextIgnore, toTextWarn, fromText + -- * Utilities.+ , (<$>), (<$$>), whenM, unlessM, time+ -- * Re-exported for your convenience , liftIO, when, unless, FilePath - -- * internal functions for writing extension+ -- * internal functions for writing extensions , get, put ) where @@ -468,24 +469,26 @@ getenv_def k d = gets sEnvironment >>= return . LT.pack . fromMaybe (LT.unpack d) . lookup (LT.unpack k) --- | Create a sub-ShIO in which external command outputs are not echoed.--- Also commands are not printed.--- See "sub".+-- | Create a sub-ShIO in which external command outputs are not echoed and+-- commands are not printed.+-- See 'sub'. silently :: ShIO a -> ShIO a silently a = sub $ modify (\x -> x { sPrintStdout = False, sPrintCommands = False }) >> a --- | Create a sub-ShIO in which external command outputs are echoed.+-- | Create a sub-ShIO in which external command outputs are echoed and -- Executed commands are printed--- See "sub".+-- See 'sub'. verbosely :: ShIO a -> ShIO a verbosely a = sub $ modify (\x -> x { sPrintStdout = True, sPrintCommands = True }) >> a -- | Create a sub-ShIO with stdout printing on or off+-- Defaults to True. print_stdout :: Bool -> ShIO a -> ShIO a print_stdout shouldPrint a = sub $ modify (\x -> x { sPrintStdout = shouldPrint }) >> a -- | Create a sub-ShIO with command echoing on or off+-- Defaults to False, set to True by 'verbosely' print_commands :: Bool -> ShIO a -> ShIO a print_commands shouldPrint a = sub $ modify (\st -> st { sPrintCommands = shouldPrint }) >> a @@ -502,7 +505,9 @@ newState <- get put oldState { sTrace = sTrace oldState `mappend` sTrace newState } --- | Create a sub-ShIO with shell character escaping on or off+-- | Create a sub-ShIO with shell character escaping on or off.+-- Defaults to True.+-- Setting to False allows for shell wildcard such as * to be expanded by the shell along with any other special shell characters. escaping :: Bool -> ShIO a -> ShIO a escaping shouldEscape action = sub $ do modify $ \st -> st { sRun =@@ -765,6 +770,10 @@ trace $ "writefile " `mappend` toTextIgnore f liftIO (TIO.writeFile (unpack f) bits) +-- | Update a file, creating (a blank file) if it does not exist.+touchfile :: FilePath -> ShIO ()+touchfile = absPath >=> flip appendfile ""+ -- | Append a Lazy Text to a file. appendfile :: FilePath -> Text -> ShIO () appendfile f' bits = absPath f' >>= \f -> do@@ -779,6 +788,9 @@ trace $ "readfile " `mappend` toTextIgnore fp (fmap LT.fromStrict . liftIO . STIO.readFile . unpack) fp +-- | flipped hasExtension for Text+hasExt :: Text -> FilePath -> Bool+hasExt = flip hasExtension . LT.toStrict -- | Run a ShIO computation and collect timing information. time :: ShIO a -> ShIO (Double, a)
shelly.cabal view
@@ -1,6 +1,6 @@ Name: shelly -Version: 0.12.1.1+Version: 0.12.2 Synopsis: shell-like (systems) programming in Haskell Description: Shelly provides convenient systems programming in Haskell,@@ -18,8 +18,6 @@ Shelly is originally forked from the Shellish package. . See the shelly-extra package for additional functionality.- .- Lately there are problems with generating the docs. The docs are there for this version: <http://hackage.haskell.org/package/shelly-0.11> Homepage: https://github.com/yesodweb/Shelly.hs