shellish 0.1 → 0.1.1
raw patch · 2 files changed
+14/−5 lines, 2 filesdep +unix-compat
Dependencies added: unix-compat
Files
- Shellish.hs +11/−3
- shellish.cabal +3/−2
Shellish.hs view
@@ -18,7 +18,7 @@ , echo, echo_n, echo_err, echo_n_err -- * Querying filesystem.- , ls, test_e, test_f, test_d, which, find+ , ls, test_e, test_f, test_d, test_s, which, find -- * Manipulating filesystem. , mv, rm_f, rm_rf, cp, cp_r, mkdir, mkdir_p@@ -40,6 +40,7 @@ import Data.Maybe import System.IO hiding ( readFile ) import System.IO.Strict( readFile )+import System.PosixCompat.Files( getSymbolicLinkStatus, isSymbolicLink ) import System.Directory import System.Exit import System.FilePath@@ -114,8 +115,9 @@ find dir = do bits <- ls dir sub <- forM bits $ \x -> do ex <- test_d $ dir </> x- if ex then find (dir </> x)- else return []+ sym <- test_s $ dir </> x+ if ex && not sym then find (dir </> x)+ else return [] return $ map (dir </>) bits ++ concat sub -- | Obtain the current (ShIO) working directory.@@ -170,6 +172,12 @@ -- | Does a path point to an existing directory? test_d :: FilePath -> ShIO Bool test_d = path >=> liftIO . doesDirectoryExist++-- | Does a path point to a symlink?+test_s :: FilePath -> ShIO Bool+test_s = path >=> liftIO . \f -> do+ stat <- getSymbolicLinkStatus f+ return $ isSymbolicLink stat -- | A swiss army cannon for removing things. Actually this goes farther than a -- normal rm -rf, as it will circumvent permission problems for the files we
shellish.cabal view
@@ -3,7 +3,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.1+Version: 0.1.1 Synopsis: shell-/perl- like (systems) programming in Haskell @@ -34,7 +34,8 @@ -- Modules exported by the library. Exposed-modules: Shellish - Build-depends: mtl, process, filepath, bytestring, base >= 4 && < 5, time, directory, strict+ Build-depends: mtl, process, filepath, bytestring, base >= 4 && < 5, time, directory, strict,+ unix-compat source-repository head type: darcs