Remove unnecessary use of Maybe from shellFor
This commit is contained in:
parent
bd3299edd3
commit
35033a9f2f
|
@ -258,9 +258,9 @@ determineShell fallbackShell t = fromMaybe Bash $
|
||||||
executableFromShebang :: String -> String
|
executableFromShebang :: String -> String
|
||||||
executableFromShebang = shellFor
|
executableFromShebang = shellFor
|
||||||
where
|
where
|
||||||
shellFor s | "/env " `isInfixOf` s = fromMaybe "" $ do
|
shellFor s | "/env " `isInfixOf` s = case matchRegex re s of
|
||||||
[flag, shell] <- matchRegex re s
|
Just [flag, shell] -> shell
|
||||||
return shell
|
_ -> ""
|
||||||
shellFor s | ' ' `elem` s = shellFor $ takeWhile (/= ' ') s
|
shellFor s | ' ' `elem` s = shellFor $ takeWhile (/= ' ') s
|
||||||
shellFor s = reverse . takeWhile (/= '/') . reverse $ s
|
shellFor s = reverse . takeWhile (/= '/') . reverse $ s
|
||||||
re = mkRegex "/env +(-S|--split-string=?)? *([^ ]*)"
|
re = mkRegex "/env +(-S|--split-string=?)? *([^ ]*)"
|
||||||
|
|
Loading…
Reference in New Issue