Fixed not recognizing --f=* as option in checkGrepRe

This commit is contained in:
Vidar Holen 2014-05-15 09:14:57 -07:00
parent fdce0116da
commit 3824e9cfc2
1 changed files with 2 additions and 1 deletions

View File

@ -1490,13 +1490,14 @@ prop_checkGrepRe7 = verify checkGrepRe "grep *foo* file"
prop_checkGrepRe8 = verify checkGrepRe "ls | grep foo*.jpg" prop_checkGrepRe8 = verify checkGrepRe "ls | grep foo*.jpg"
prop_checkGrepRe9 = verifyNot checkGrepRe "grep '[0-9]*' file" prop_checkGrepRe9 = verifyNot checkGrepRe "grep '[0-9]*' file"
prop_checkGrepRe10= verifyNot checkGrepRe "grep '^aa*' file" prop_checkGrepRe10= verifyNot checkGrepRe "grep '^aa*' file"
prop_checkGrepRe11= verifyNot checkGrepRe "grep --include=*.png foo"
checkGrepRe _ = checkCommand "grep" (const f) where checkGrepRe _ = checkCommand "grep" (const f) where
-- --regex=*(extglob) doesn't work. Fixme? -- --regex=*(extglob) doesn't work. Fixme?
skippable (Just s) = not ("--regex=" `isPrefixOf` s) && "-" `isPrefixOf` s skippable (Just s) = not ("--regex=" `isPrefixOf` s) && "-" `isPrefixOf` s
skippable _ = False skippable _ = False
f [] = return () f [] = return ()
f (x:r) | skippable (getLiteralString x) = f r f (x:r) | skippable (getLiteralStringExt (const $ return "_") x) = f r
f (re:_) = do f (re:_) = do
when (isGlob re) $ do when (isGlob re) $ do
warn (getId re) 2062 $ "Quote the grep pattern so the shell won't interpret it." warn (getId re) 2062 $ "Quote the grep pattern so the shell won't interpret it."