Remove not functions from Glob API for now.

This commit is contained in:
Dillon Kearns 2021-04-25 20:34:56 -07:00
parent ad732d428e
commit 664cb77c78
2 changed files with 2 additions and 73 deletions

View File

@ -1,11 +1,11 @@
module Glob exposing
( Glob, atLeastOne, extractMatches, fullFilePath, literal, map, not, notOneOf, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
( Glob, atLeastOne, extractMatches, fullFilePath, literal, map, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
, capture, ignore
)
{-|
@docs Glob, atLeastOne, extractMatches, fullFilePath, literal, map, not, notOneOf, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
@docs Glob, atLeastOne, extractMatches, fullFilePath, literal, map, oneOf, recursiveWildcard, run, singleFile, succeed, toNonEmptyWithDefault, toPattern, toDataSource, wildcard, zeroOrMore
@docs capture, ignore
@ -122,44 +122,6 @@ regexEscaped stringLiteral =
stringLiteral
{-| -}
not : String -> Glob String
not string =
Glob ("!(" ++ string ++ ")")
"TODO"
(\_ captures ->
case captures of
first :: rest ->
( first, rest )
[] ->
( "ERROR", [] )
)
{-| -}
notOneOf : ( String, List String ) -> Glob String
notOneOf ( firstPattern, otherPatterns ) =
let
allPatterns =
firstPattern :: otherPatterns
in
Glob
("!("
++ (allPatterns |> String.join "|")
++ ")"
)
"TODO"
(\_ captures ->
case captures of
first :: rest ->
( first, rest )
[] ->
( "ERROR", [] )
)
{-| -}
run : String -> RawGlob -> Glob a -> { match : a, pattern : String }
run rawInput { captures, fullPath } (Glob pattern regex applyCapture) =
@ -171,7 +133,6 @@ run rawInput { captures, fullPath } (Glob pattern regex applyCapture) =
regexCaptures =
Regex.find parsedRegex rawInput
|> List.concatMap .submatches
|> List.filterMap identity
|> List.map (Maybe.withDefault "")
parsedRegex =

View File

@ -124,38 +124,6 @@ all =
, expectedMatch = ( "a/b/c", "d" )
, expectedPattern = "**/*.txt"
}
, test "not" <|
\() ->
Glob.succeed Tuple.pair
|> Glob.capture
(Glob.notOneOf
( "xyz", [] )
)
|> Glob.ignore (Glob.literal "/")
|> Glob.capture Glob.wildcard
|> Glob.ignore (Glob.literal ".txt")
|> expect "abc/d.txt"
-- abc/d.txt
-- https://runkit.com/embed/05epbnc0c7g1
{ captures = [ "abc", "d" ]
, expectedMatch = ( "abc", "d" )
, expectedPattern = "!(xyz)/*.txt"
}
, test "not with multiple patterns" <|
\() ->
Glob.succeed Tuple.pair
|> Glob.capture
(Glob.notOneOf ( "abz", [ "xyz" ] ))
|> Glob.ignore (Glob.literal "/")
|> Glob.capture Glob.wildcard
|> Glob.ignore (Glob.literal ".txt")
|> expect "abc/d.txt"
-- abc/d.txt
-- https://runkit.com/embed/05epbnc0c7g1
{ captures = [ "abc", "d" ]
, expectedMatch = ( "abc", "d" )
, expectedPattern = "!(abz|xyz)/*.txt"
}
]