packages feed

hsshellscript 3.3.1 → 3.3.2

raw patch · 9 files changed

+89/−51 lines, 9 filesdep ~basedep ~unixPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, unix

API changes (from Hackage documentation)

- HsShellScript.Misc: with_wd :: FilePath -> IO a -> IO a
- HsShellScript.ProcErr: tyCon_ProcessStatus :: TypeRep
+ HsShellScript.Commands: with_wd :: FilePath -> IO a -> IO a

Files

Makefile view
@@ -1,5 +1,4 @@-CFLAGS = -XScopedTypeVariables-VERSION = 3.3.1+VERSION = 3.3.2  default :: lib 
hsshellscript.cabal view
@@ -1,5 +1,5 @@ Name:                hsshellscript-Version:             3.3.1+Version:             3.3.2 Synopsis:            Haskell for Unix shell scripting tasks Description:         A Haskell-library for tasks which are usually done in                      shell scripts. This includes parsing command line@@ -33,7 +33,8 @@                      ForeignFunctionInterface,                      RecordWildCards,                      ScopedTypeVariables,-                     NamedFieldPuns+                     NamedFieldPuns,+                     StandaloneDeriving   Build-depends:     base >= 3 && < 6,                      unix >= 2.3.2,                      directory,
manual/index.html view
@@ -8,12 +8,12 @@ <H1>HsShellScript User Manual</H1>  <P>This is the user manual for the <A HREF="http://www.volker-wysk.de/hsshellscript">HsShellScript</A>-Haskell shell scripting library, version 3.3.1. It has been released 2012-09-30. The API+Haskell shell scripting library, version 3.3.2. It has been released 2014-08-06. The API documentation is in a separate document.</P> <P>HsShellScript is a library which makes things easy to program in Haskell, which are typically done by shell scripts on Unix-like systems. You can use Haskell for writing your shell scripts.</P>-<p>Of course your Haskell scripts can grow to become real programs. It's all ready.+<p>So your Haskell scripts can grow to become real programs. It's all ready.  <P><A HREF="features.html">Features</A> <BR><A HREF="requirements.html">Requirements</A>@@ -23,6 +23,6 @@ <BR><A HREF="LICENSE">License</A></P>  <P STYLE="border-top: 1px solid #000000; border-bottom: none; border-left: none; border-right: none; padding-top: 0.05cm; padding-bottom: 0cm; padding-left: 0cm; padding-right: 0cm">-<small>Last changed 2012-09-30</small></P>+<small>Last changed 2014-08-06</small></P> </BODY> </HTML>
manual/requirements.html view
@@ -14,9 +14,12 @@ <p><b>Requirements for using and for building</b> <UL> 	<LI><P>The <A HREF="http://www.haskell.org/ghc/">Glasgow Haskell-    	Compiler</A>. It works with GHC-7.4.1, and-  should also work with later versions. It might work with GHC-7.2, but does-  not work with GHC-7.0.4 or older.+    	Compiler</A>. +            It works with GHC-7.8.3, and+            should also work with versions 7.8.0 upwards. Because of incompatible+            changes in GHC, it <i>does not</i> work with GHC-7.6 and older.+          </P>+ 	<LI><P>A Unix like system. HsShellScript is being developed and tested on Linux.</P> </UL> @@ -27,9 +30,7 @@ 	<LI><P><A HREF="http://haskell.cs.yale.edu/haddock/">Haddock</A> for the API documentation</P> </UL> <p>GHC and Haddock are included in-  the <a href="http://hackage.haskell.org/platform/">The Haskell Platform</a>, -  c2hs isn't.-+  the <a href="http://hackage.haskell.org/platform/">The Haskell Platform</a>.  <P STYLE="border-top: 1px solid #000000; border-bottom: none; border-left: none; border-right: none; padding-top: 0.05cm; padding-bottom: 0cm; padding-left: 0cm; padding-right: 0cm"> <small><a href="index.html">HsShellScript User Manual main page</a></small></P>
src/HsShellScript/Args.hs view
@@ -1,6 +1,6 @@ -- | -- This module provides a more convient way of parsing command line--- arguments than the GHC GetOpt package. It makes use of GetOpt, but hides+-- arguments than the GHC GetOpt package. It uses GetOpt, but hides -- it from the user. It is reexported from module HsShellScript. -- -- For each command line argument, a description is to be created with@@ -275,10 +275,14 @@    )  -- |--- Long name of the argument. This specifies a GNU style long--- name for the argument, like @--arg@ or @--arg=...@. There can be specified--- several names for the same argument. Each argument needs at least--- either a short or a long name.++-- Long name of the argument. This specifies a GNU style long name for the argument, which is+-- introduced by two dashes, like @--arg@ or @--arg=...@. There can be specified several names for+-- the same argument. Each argument needs at least either a short or a long name. Except for direct +-- arguments, which don't have a name.+--+-- See 'desc_direct'+ desc_long :: String                     -- ^ The long name of the argument.           -> ArgumentProperty     -- ^ The corresponding argument property. desc_long str = ArgumentProperty@@ -291,12 +295,11 @@    )  -- |--- Signal that this is the description of direct arguments. Direct arguments--- are the ones not introduced by any short or long argument names (like--- @-x@ or @--arg@), or which occur after the special--- argument @--@. The presence of @desc_direct@ in the argument properties list--- signals @argdesc@ that this is the description of the direct--- arguments. There may be at most one such description.+-- Signal that this is the description of direct arguments. Direct arguments are the ones not+-- introduced by any short or long argument names (like @-x@ or @--arg@). After the special argument+-- @--@, also everything is a direct argument, even when starting with @-@ or @--@. The presence of+-- @desc_direct@ in the argument properties list signals @argdesc@ that this is the description of+-- the direct arguments. There may be at most one such description. desc_direct :: ArgumentProperty desc_direct = ArgumentProperty    (\desc ->@@ -457,7 +460,7 @@ abort msg desc = error (msg ++ "\nargument (so far): " ++ argname desc)  -- | Generate a descriptive argument name from an argument description, suitable for use in error messages. This uses the long and short argument names--- (as specified by 'desc_short' and 'desc_long') and generates descriptive names of the argument like \"-f\", \"-myflag\", \"-f\/--myflag\", etc. All the+-- (as specified by 'desc_short' and 'desc_long') and generates descriptive names of the argument like \"-f\", \"--myflag\", \"-f\/--myflag\", etc. All the -- argument names are included. In case of direct arguments (see 'desc_direct'), the descriptive name is \"@(direct argument)@\". argname :: ArgumentDescription -> String argname desc =@@ -466,7 +469,7 @@          else concat (intersperse "/" ( map (\s -> "-"++[s]) (argdesc_short_args desc) ++ map ("--" ++) (argdesc_long_args desc) ))  -- | Generate a descriptive argument name from an argument description, beginning with \"argument\". This uses the long and short argument names (as--- specified by 'desc_short' and 'desc_long') and generates descriptive names of the argument like \"argument -f\", \"argument -myflag\", \"argument+-- specified by 'desc_short' and 'desc_long') and generates descriptive names of the argument like \"argument -f\", \"argument --myflag\", \"argument -- -f\/--myflag\", etc. All the argument names are included. In case of direct arguments (see 'desc_direct'), the descriptive name is \"direct argument\". argname_a :: ArgumentDescription -> String argname_a desc =@@ -496,7 +499,7 @@ -- | -- Make an argument description from a list of argument properties. This -- condenses the list to an argument description,--- which can be uses by the @getargs@... functions and the+-- which can be used by the @getargs@... functions and the -- argument value extraction functions. argdesc :: [ArgumentProperty]     -- ^ List of properties, which describe the command line argument.         -> ArgumentDescription    -- ^ The corresponding argument description.
src/HsShellScript/Commands.chs view
@@ -9,7 +9,7 @@ import Foreign.C import Foreign.C.Error import Foreign.Ptr-import GHC.IO+import GHC.IO hiding (bracket) import GHC.IO.Exception                 -- InvalidArgument, UnsupportedOperation import HsShellScript.Misc import HsShellScript.Misc@@ -20,6 +20,7 @@ import Data.List import Data.Maybe import Control.Monad+import Control.Exception import Text.ParserCombinators.Parsec as Parsec import System.Posix hiding (rename, createDirectory, removeDirectory) import System.Posix.Env@@ -89,8 +90,8 @@ -- Make a symbolic link. This is the @symlink(2)@ function. Any error results in an @IOError@ thrown. The path of the intended symlink is included in -- the @IOError@ and -- can be accessed with @ioeGetFileName@ from the Haskell standard library @IO@.-symlink :: String       -- ^ contents of the symlink (/from/)-        -> String       -- ^ path of the symlink (/to/)+symlink :: String       -- ^ contents of the symlink+        -> String       -- ^ path of the symlink         -> IO () symlink oldpath newpath = do    o <- newCString oldpath@@ -156,7 +157,7 @@    (When talking about the \"shell\", I'm talking about bash, regardless of whether started as @\/bin\/bash@ or in compatibility mode, as @\/bin\/sh@. I    presume it's the standard behavior for the POSIX standard shell.) -   See 'pwd'.+   See 'pwd', 'with_wd' -} cd :: String         -- ^ path    -> IO ()@@ -171,10 +172,27 @@ -- directory path in which the program has been started. Symbolic links in -- this path aren't expanded. In this way, it differs from -- @getCurrentDirectory@ from the Haskell standard library.+--   +-- See 'cd', 'with_wd' pwd :: IO String pwd = fmap (fromMaybe "") (System.Posix.Env.getEnv "PWD")  ++-- | Change the working directory temporarily. This executes the specified IO action with a new working directory, and restores it afterwards+-- (exception-safely).+with_wd :: FilePath     -- ^ New working directory+        -> IO a         -- ^ Action to run+        -> IO a+with_wd wd io =+   bracket (do cwd <- getCurrentDirectory+               setCurrentDirectory wd+               return cwd)+           (\cwd -> setCurrentDirectory cwd)+           (const io)+++ {- | Execute @\/bin\/chmod@  >chmod = run "/bin/chmod"@@ -203,11 +221,16 @@   -- |--- Execute the mv program+-- Execute the mv program. +--+-- This calls the @\/bin\/mv@ to rename a file, or move it to another directory. You can move a file to another file system with this.+-- This starts a new process, which is rather slow. Consider using @rename@ instead, when possible.+--+-- See 'rename'. mv :: String    -- ^ source    -> String    -- ^ destination    -> IO ()-mv from to = run "mv" ["--", from, to]+mv from to = runprog "/bin/mv" ["--", from, to]   number  :: Parser Int
src/HsShellScript/Misc.chs view
@@ -431,21 +431,9 @@ foreign import ccall unsafe "HsBase.h __hscore_o_excl"   o_EXCL   :: CInt  --- | Change the working directory temporarily. This executes the specified IO action with a new working directory, and restores it afterwards--- (exception-safely).-with_wd :: FilePath     -- ^ New working directory-        -> IO a         -- ^ Action to run-        -> IO a-with_wd wd io =-   bracket (do cwd <- getCurrentDirectory-               setCurrentDirectory wd-               return cwd)-           (\cwd -> setCurrentDirectory cwd)-           (const io) - -- | This is an interface to the POSIX @glob@ function, which does wildcard expansion--- in paths. The list of matched paths is returned. It's empty+-- in paths. The sorted list of matched paths is returned. It's empty -- for no match (rather than the original pattern). In case anything goes wrong -- (such as permission denied), an IOError is thrown. --
src/HsShellScript/Paths.hs view
@@ -414,12 +414,18 @@  This makes a relative path absolute with respect to a specified directory. An absolute path is returned unmodified.++The directory must be an absolute path.++>absolute_path_by absdir path@('/':p) = path+>absolute_path_by absdir path = absdir ++ "/" ++ path -}-absolute_path_by :: String        -- ^ The directory relative to which the path is made absolute-                 -> String        -- ^ The path to be made absolute+absolute_path_by :: String        -- ^ In case the path is relative, the directory relative to which it is+                 -> String        -- ^ The path to be made absolute (must be absolute)                  -> String        -- ^ Absolute path-absolute_path_by dir path@('/':p) = path-absolute_path_by dir path = dir ++ "/" ++ path+absolute_path_by absdir path@('/':p) = path+absolute_path_by absdir path = +   absdir ++ "/" ++ path   {- | Make a path absolute.@@ -457,6 +463,11 @@    components, then the @\"..\"@ components can't be normalised away. In this case, the result is @Nothing@.  >guess_dotdot = fmap unslice_path . guess_dotdot_comps . slice_path++>guess_dotdot "foo/../bar"    = Just "bar"+>guess_dotdot "foo/..//bar/." = Just "bar"+>guess_dotdot "foo/../../bar" = Nothing+>guess_dotdot "../bar" = Nothing -} guess_dotdot :: String                  -- ^ Path to be normalised              -> Maybe String            -- ^ In case the path could be transformed, the normalised, @\"..\"@-component free form of the path.
src/HsShellScript/ProcErr.chs view
@@ -1,4 +1,10 @@ -- #hide++-- New Typeable class in GHC 7.8:+-- http://www.haskell.org/ghc/docs/7.8.3/html/libraries/base-4.7.0.1/Data-Typeable.html+-- https://ghc.haskell.org/trac/ghc/wiki/GhcKinds/PolyTypeable++ module HsShellScript.ProcErr where  import Control.Concurrent.MVar@@ -288,7 +294,7 @@    case ps of       Exited (ExitFailure ec) -> "The program exited abnormally with an exit code of " ++ show ec ++ "."       Exited ExitSuccess      -> "The program finished normally."-      Terminated sig          -> "The process was terminated by signal " ++ showsig sig ++ "."+      Terminated sig coredump -> "The process was terminated by signal " ++ showsig sig ++ "."       Stopped sig             -> "The process was stopped by signal " ++ showsig sig ++ "."    where       showsig sig = show sig ++@@ -2292,6 +2298,11 @@                    | Stopped Signal 		   deriving (Eq, Ord, Show) -}++-- For GHC-7.8:+deriving instance Typeable ProcessStatus++{- Pre-7.8-Stuff: instance Typeable ProcessStatus where    typeOf = const tyCon_ProcessStatus @@ -2299,6 +2310,7 @@ tyCon_ProcessStatus = mkTyConApp (mkTyCon3 "hsshellscript"                                            "HsShellScript.ProcErr"                                            "Posix.ProcessStatus") []+-}   -- | The GHC libraries don't declare @Foreign.C.Error.Errno@ as instance of