shelly 1.6.5 → 1.6.6
raw patch · 5 files changed
+32/−13 lines, 5 filesdep ~basedep ~timePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, time
API changes (from Hackage documentation)
+ Shelly: prependToPath :: FilePath -> Sh ()
+ Shelly.Lifted: prependToPath :: MonadSh m => FilePath -> m ()
+ Shelly.Pipe: prependToPath :: FilePath -> Sh ()
Files
- ChangeLog.md +4/−0
- shelly.cabal +1/−1
- src/Shelly.hs +9/−1
- src/Shelly/Lifted.hs +12/−9
- src/Shelly/Pipe.hs +6/−2
ChangeLog.md view
@@ -1,3 +1,7 @@+# 1.6.6++* add prependToPath function+ # 1.6.5 * expose MonadShControl
shelly.cabal view
@@ -1,6 +1,6 @@ Name: shelly -Version: 1.6.5+Version: 1.6.6 Synopsis: shell-like (systems) programming in Haskell Description: Shelly provides convenient systems programming in Haskell,
src/Shelly.hs view
@@ -45,7 +45,7 @@ , HandleInitializer, StdInit(..), initOutputHandles, initAllHandles -- * Modifying and querying environment.- , setenv, get_env, get_env_text, getenv, get_env_def, get_env_all, get_environment, appendToPath+ , setenv, get_env, get_env_text, getenv, get_env_def, get_env_all, get_environment, appendToPath, prependToPath -- * Environment directory , cd, chdir, chdir_p, pwd@@ -749,6 +749,14 @@ tp <- toTextWarn filepath pe <- get_env_text path_env setPath $ pe <> T.singleton searchPathSeparator <> tp++-- | prepend the filepath to the PATH env variable+-- similar to `appendToPath` but gives high priority to the filepath instead of low priority.+prependToPath :: FilePath -> Sh ()+prependToPath = traceAbsPath ("prependToPath: " <>) >=> \filepath -> do+ tp <- toTextWarn filepath+ pe <- get_env_text path_env+ setPath $ tp <> T.singleton searchPathSeparator <> pe get_environment :: Sh [(String, String)] get_environment = gets sEnvironment
src/Shelly/Lifted.hs view
@@ -51,7 +51,7 @@ -- * Modifying and querying environment.- , setenv, get_env, get_env_text, get_env_all, appendToPath+ , setenv, get_env, get_env_text, get_env_all, appendToPath, prependToPath -- * Environment directory , cd, chdir, chdir_p, pwd@@ -156,19 +156,19 @@ instance (Monoid w, MonadSh m) => MonadSh (WriterT w m) where liftSh m = WriterT $ do a <- liftSh m- return (a, mempty)+ return (a, mempty :: w) instance (Monoid w, MonadSh m) => MonadSh (Strict.WriterT w m) where liftSh m = Strict.WriterT $ do a <- liftSh m- return (a, mempty)+ return (a, mempty :: w) instance (Monoid w, MonadSh m) => MonadSh (RWS.RWST r w s m) where liftSh m = RWS.RWST $ \_ s -> do a <- liftSh m- return (a, s, mempty)+ return (a, s, mempty :: w) instance (Monoid w, MonadSh m) => MonadSh (Strict.RWST r w s m) where liftSh m = Strict.RWST $ \_ s -> do a <- liftSh m- return (a, s, mempty)+ return (a, s, mempty :: w) instance MonadSh m => S.ShellCmd (m Text) where cmdAll = (liftSh .) . S.run@@ -223,7 +223,7 @@ => MonadShControl (WriterT w m) where newtype ShM (WriterT w m) a = WriterTShM (ShM m (a, w)) liftShWith f =- WriterT $ liftM (\x -> (x, mempty)) $ liftShWith $ \runInSh -> f $ \k ->+ WriterT $ liftM (\x -> (x, mempty :: w)) $ liftShWith $ \runInSh -> f $ \k -> liftM WriterTShM $ runInSh $ runWriterT k restoreSh (WriterTShM m) = WriterT . restoreSh $ m {-# INLINE liftShWith #-}@@ -233,7 +233,7 @@ => MonadShControl (Strict.WriterT w m) where newtype ShM (Strict.WriterT w m) a = StWriterTShM (ShM m (a, w)) liftShWith f =- Strict.WriterT $ liftM (\x -> (x, mempty)) $ liftShWith $ \runInSh -> f $ \k ->+ Strict.WriterT $ liftM (\x -> (x, mempty :: w)) $ liftShWith $ \runInSh -> f $ \k -> liftM StWriterTShM $ runInSh $ Strict.runWriterT k restoreSh (StWriterTShM m) = Strict.WriterT . restoreSh $ m {-# INLINE liftShWith #-}@@ -280,7 +280,7 @@ => MonadShControl (RWS.RWST r w s m) where newtype ShM (RWS.RWST r w s m) a = RWSTShM (ShM m (a, s ,w)) liftShWith f = RWS.RWST $ \r s ->- liftM (\x -> (x,s,mempty)) $ liftShWith $ \runInSh -> f $ \k ->+ liftM (\x -> (x,s,mempty :: w)) $ liftShWith $ \runInSh -> f $ \k -> liftM RWSTShM $ runInSh $ RWS.runRWST k r s restoreSh (RWSTShM m) = RWS.RWST . const . const . restoreSh $ m {-# INLINE liftShWith #-}@@ -290,7 +290,7 @@ => MonadShControl (Strict.RWST r w s m) where newtype ShM (Strict.RWST r w s m) a = StRWSTShM (ShM m (a, s, w)) liftShWith f = Strict.RWST $ \r s ->- liftM (\x -> (x,s,mempty)) $ liftShWith $ \runInSh -> f $ \k ->+ liftM (\x -> (x,s,mempty :: w)) $ liftShWith $ \runInSh -> f $ \k -> liftM StRWSTShM $ runInSh $ Strict.runRWST k r s restoreSh (StRWSTShM m) = Strict.RWST . const . const . restoreSh $ m {-# INLINE liftShWith #-}@@ -458,6 +458,9 @@ appendToPath :: MonadSh m => FilePath -> m () appendToPath = liftSh . S.appendToPath++prependToPath :: MonadSh m => FilePath -> m ()+prependToPath = liftSh . S.prependToPath get_env_all :: MonadSh m => m [(String, String)] get_env_all = liftSh S.get_env_all
src/Shelly/Pipe.hs view
@@ -45,9 +45,9 @@ , (-|-), lastStderr, setStdin, lastExitCode , command, command_, command1, command1_ , sshPairs, sshPairs_- + -- * Modifying and querying environment.- , setenv, get_env, get_env_text, get_env_def, appendToPath+ , setenv, get_env, get_env_text, get_env_def, appendToPath, prependToPath -- * Environment directory , cd, chdir, pwd@@ -338,6 +338,10 @@ -- | see 'S.appendToPath' appendToPath :: FilePath -> Sh () appendToPath = sh1 S.appendToPath++-- | see 'S.prependToPath'+prependToPath :: FilePath -> Sh ()+prependToPath = sh1 S.prependToPath -- | see 'S.cd' cd :: FilePath -> Sh ()