Glob 0.6.1 → 0.7
raw patch · 6 files changed
+105/−38 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- System.FilePath.Glob: glob :: Pattern -> IO [FilePath]
+ System.FilePath.Glob: glob :: String -> IO [FilePath]
Files
- CHANGELOG.txt +8/−0
- Glob.cabal +2/−1
- LICENSE.txt +28/−28
- README.txt +21/−0
- System/FilePath/Glob.hs +34/−3
- System/FilePath/Glob/Directory.hs +12/−6
CHANGELOG.txt view
@@ -1,3 +1,11 @@+0.7, 2012-01-03:+ Changed function types:+ System.FilePath.Glob.glob :: String -> IO [FilePath]+ Now takes a String to be compiled instead of an already-compiled+ Pattern.++ Added a README and more basic usage documentation.+ 0.6.1, 2011-09-14: Bug fix: globDir should now ignore the given directory when given an absolute path on Windows.
Glob.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.6 Name: Glob-Version: 0.6.1+Version: 0.7 Homepage: http://iki.fi/matti.niemenmaa/glob/ Synopsis: Globbing library Category: System@@ -18,6 +18,7 @@ Extra-Source-Files: CHANGELOG.txt CREDITS.txt+ README.txt tests/README.txt tests/*.hs tests/Tests/*.hs
LICENSE.txt view
@@ -1,28 +1,28 @@-The code in Glob is released under the license below. Copyrights to parts of -the code are held by whoever wrote the code in question: see CREDITS.txt for a -list of authors. - -Copyright (c) 2008-2011 <authors> -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the project nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +The code in Glob is released under the license below. Copyrights to parts of+the code are held by whoever wrote the code in question: see CREDITS.txt for a+list of authors.++Copyright (c) 2008-2012 <authors>+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:+ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.+ * Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.+ * Neither the name of the project nor the names of its contributors may be+ used to endorse or promote products derived from this software without+ specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO+EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.txt view
@@ -0,0 +1,21 @@+This is Glob, a Haskell library for globbing, i.e. pattern matching file paths+akin to the POSIX glob() function. Haddock documentation is included, and can+be built with the 'cabal haddock' command. Basic usage info is repeated below:++Matching pattern (a String) against filepath (a FilePath):++ match (compile pattern) filepath++Matching a pattern against all paths in the current working directory:++ glob pattern++Matching a pattern against all paths in a given directory (a FilePath):++ globDir1 (compile pattern) directorypath++Matching a list of patterns against all paths in a given directory, returning+the matches for each pattern as well as the paths not matched by any of the+patterns:++ globDir (map compile patterns) directorypath
System/FilePath/Glob.hs view
@@ -1,10 +1,41 @@ -- File created: 2008-10-10 13:37:42 --- | A library for globbing: matching patterns against file paths.+-- | A library for globbing: matching patterns against file paths akin to the+-- POSIX @glob()@ function. ----- Basic usage: @'match' ('compile' pattern) filepath@.+-- Pattern syntax is documented by 'compile'. To toggle features at compile+-- time, look into 'CompOptions'. To modify matching behaviour, look into+-- 'MatchOptions'. ----- Basic usage in IO: @'globDir' ['compile' pattern] directory@.+-- Basic usage examples:+--+-- Matching a 'String' pattern against a 'FilePath':+--+-- @+-- 'match' ('compile' pattern) filepath+-- @+--+-- Matching a 'String' pattern against all paths in the current working+-- directory:+--+-- @+-- 'glob' pattern+-- @+--+-- Matching a 'String' pattern against all paths in a given directory (a+-- 'FilePath'):+--+-- @+-- 'globDir1' ('compile' pattern) directorypath+-- @+--+-- Matching a list of 'String' patterns against all paths in a given directory,+-- returning the matches for each pattern as well as the paths not matched by+-- any of the patterns:+--+-- @+-- 'globDir' (map 'compile' patterns) directorypath+-- @ module System.FilePath.Glob ( -- * Data type Pattern
System/FilePath/Glob/Directory.hs view
@@ -20,6 +20,7 @@ import System.FilePath.Glob.Base ( Pattern(..), Token(..) , MatchOptions, matchDefault+ , compile ) import System.FilePath.Glob.Match (matchWith) import System.FilePath.Glob.Utils ( getRecursiveContents@@ -73,7 +74,7 @@ -- 'Pattern' starts with a path separator, only the drive part of the -- 'FilePath' is used. On Posix systems these behaviours are equivalent: -- 'Pattern's starting with @\/@ work relative to @\/@. On Windows, 'Pattern's--- starting with @\/@ or @\\@ work relative only to the drive part of+-- starting with @\/@ or @\\@ work relative only to the drive part of the -- 'FilePath' and 'Pattern's starting with absolute paths ignore the -- 'FilePath'. --@@ -109,14 +110,19 @@ ) -- |A convenience wrapper on top of 'globDir', for when you only have one--- 'Pattern' you care about.+-- 'Pattern' you care about. Returns only the matched paths. globDir1 :: Pattern -> FilePath -> IO [FilePath] globDir1 p = fmap (head . fst) . globDir [p] --- |A convenience wrapper on top of 'globDir1', for when you want to work in--- the current directory or have a 'Pattern' referring to an absolute path.-glob :: Pattern -> IO [FilePath]-glob = flip globDir1 ""+-- |The simplest IO function. Finds matches to the given pattern in the current+-- working directory. Takes a 'String' instead of a 'Pattern' to avoid the need+-- for a call to 'compile', simplifying usage further.+--+-- Can also be seen as a convenience wrapper on top of 'globDir1', for when you+-- want to work in the current directory or have a pattern referring to an+-- absolute path.+glob :: String -> IO [FilePath]+glob = flip globDir1 "" . compile globDir'0 :: MatchOptions -> Pattern -> FilePath -> IO (DList FilePath, DList FilePath)