Distribution.Simple.Glob

Cabal-2.4.0.1: A framework for packaging Haskell software

Copyright | Isaac Jones Simon Marlow 2003-2004
License | BSD3 portions Copyright (c) 2007, Galois Inc.
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell2010

Distribution.Simple.Glob

Description

Simple file globbing.

Synopsis

- data GlobSyntaxError
  - = StarInDirectory
  - | StarInFileName
  - | StarInExtension
  - | NoExtensionOnStar
  - | EmptyGlob
  - | LiteralFileNameGlobStar
  - | VersionDoesNotSupportGlobStar
  - | VersionDoesNotSupportGlob
- data GlobResult a
  - = GlobMatch a
  - | GlobWarnMultiDot a
  - | GlobMissingDirectory FilePath
- matchDirFileGlob :: Verbosity -> Version -> FilePath -> FilePath -> IO [FilePath]
- runDirFileGlob :: Verbosity -> FilePath -> Glob -> IO [GlobResult FilePath]
- fileGlobMatches :: Glob -> FilePath -> Maybe (GlobResult FilePath)
- parseFileGlob :: Version -> FilePath -> Either GlobSyntaxError Glob
- explainGlobSyntaxError :: FilePath -> GlobSyntaxError -> String
- data Glob

# Documentation

data GlobSyntaxError #

Constructors

StarInDirectory |
StarInFileName |
StarInExtension |
NoExtensionOnStar |
EmptyGlob |
LiteralFileNameGlobStar |
VersionDoesNotSupportGlobStar |
VersionDoesNotSupportGlob |

Instances

Eq GlobSyntaxError # |
Instance details Defined in Distribution.Simple.Glob Methods (==) :: GlobSyntaxError -> GlobSyntaxError -> Bool # (/=) :: GlobSyntaxError -> GlobSyntaxError -> Bool #
Show GlobSyntaxError # |
Instance details Defined in Distribution.Simple.Glob Methods showsPrec :: Int -> GlobSyntaxError -> ShowS Source # show :: GlobSyntaxError -> String Source # showList :: [GlobSyntaxError] -> ShowS Source #

data GlobResult a #

Constructors

GlobMatch a | The glob matched the value supplied.
GlobWarnMultiDot a | The glob did not match the value supplied because the cabal-version is too low and the extensions on the file did not precisely match the glob's extensions, but rather the glob was a proper suffix of the file's extensions; i.e., if not for the low cabal-version, it would have matched.
GlobMissingDirectory FilePath | The glob couldn't match because the directory named doesn't exist. The directory will be as it appears in the glob (i.e., relative to the directory passed to `matchDirFileGlob`, and, for 'data-files', relative to 'data-dir').

Instances

Functor GlobResult # |
Instance details Defined in Distribution.Simple.Glob Methods fmap :: (a -> b) -> GlobResult a -> GlobResult b Source # (<$) :: a -> GlobResult b -> GlobResult a Source #
Eq a => Eq (GlobResult a) # |
Instance details Defined in Distribution.Simple.Glob Methods (==) :: GlobResult a -> GlobResult a -> Bool # (/=) :: GlobResult a -> GlobResult a -> Bool #
Ord a => Ord (GlobResult a) # |
Instance details Defined in Distribution.Simple.Glob Methods compare :: GlobResult a -> GlobResult a -> Ordering # (<) :: GlobResult a -> GlobResult a -> Bool # (<=) :: GlobResult a -> GlobResult a -> Bool # (>) :: GlobResult a -> GlobResult a -> Bool # (>=) :: GlobResult a -> GlobResult a -> Bool # max :: GlobResult a -> GlobResult a -> GlobResult a # min :: GlobResult a -> GlobResult a -> GlobResult a #
Show a => Show (GlobResult a) # |
Instance details Defined in Distribution.Simple.Glob Methods showsPrec :: Int -> GlobResult a -> ShowS Source # show :: GlobResult a -> String Source # showList :: [GlobResult a] -> ShowS Source #

matchDirFileGlob :: Verbosity -> Version -> FilePath -> FilePath -> IO [FilePath] #

This will `die'` when the glob matches no files, or if the glob refers to a missing directory, or if the glob fails to parse.

The returned values do not include the supplied `dir` prefix, which must itself be a valid directory (hence, it can't be the empty string).

runDirFileGlob :: Verbosity -> FilePath -> Glob -> IO [GlobResult FilePath] #

Match files against a pre-parsed glob, starting in a directory.

The returned values do not include the supplied `dir` prefix, which must itself be a valid directory (hence, it can't be the empty string).

fileGlobMatches :: Glob -> FilePath -> Maybe (GlobResult FilePath) #

Returns `Nothing` if the glob didn't match at all, or `Just` the result if the glob matched (or would have matched with a higher cabal-version).

parseFileGlob :: Version -> FilePath -> Either GlobSyntaxError Glob #

explainGlobSyntaxError :: FilePath -> GlobSyntaxError -> String #

data Glob #