Adds support for a SHELLCHECK_OPTS environment variable.

This commit is contained in:
Vidar Holen 2015-08-22 13:15:10 -07:00
parent d0029ae1d4
commit ae4aea4530
3 changed files with 25 additions and 1 deletions

View file

@ -71,3 +71,10 @@ subRegex re input replacement = f input
(before, match, after) <- matchM re str :: Maybe (String, String, String)
when (null match) $ error ("Internal error: substituted empty in " ++ str)
return $ before ++ replacement ++ f after
-- Split a string based on a regex.
splitOn :: String -> Regex -> [String]
splitOn input re =
case matchM re input :: Maybe (String, String, String) of
Just (before, match, after) -> before : after `splitOn` re
Nothing -> [input]