summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-28 16:09:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-28 16:09:11 -0400
commit8a4a3be9f6573c090d8d919ea1453d18264941ad (patch)
treeb7b9975451a52521e58d1b66292eb11ab2d75c70
parented2b1eda909d14b604b487b9ddeb7a39bd2b8ce4 (diff)
simplify
-rw-r--r--Command.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Command.hs b/Command.hs
index fd49531f4..a07ae6e09 100644
--- a/Command.hs
+++ b/Command.hs
@@ -15,6 +15,7 @@ import System.Path.WildMatch
import Text.Regex.PCRE.Light.Char8
import Data.List
import Data.Maybe
+import Data.String.Utils
import Types
import qualified Backend
@@ -195,11 +196,9 @@ filterFiles l = do
wildsRegex :: [String] -> Regex
wildsRegex ws = compile regex []
- where regex = "^(" ++ wildsRegex' ws "" ++ ")"
-wildsRegex' :: [String] -> String -> String
-wildsRegex' [] c = c
-wildsRegex' (w:ws) "" = wildsRegex' ws (wildToRegex w)
-wildsRegex' (w:ws) c = wildsRegex' ws (c ++ "|" ++ wildToRegex w)
+ where
+ regex = "^(" ++ alternatives ++ ")"
+ alternatives = join "|" $ map wildToRegex ws
{- filter out symlinks -}
notSymlink :: FilePath -> IO Bool