Simplify getCommandNameAndToken
This commit is contained in:
parent
01f4423465
commit
8f105074fe
|
@ -317,13 +317,11 @@ getCommandNameAndToken :: Token -> (Maybe String, Token)
|
||||||
getCommandNameAndToken t = fromMaybe (Nothing, t) $ do
|
getCommandNameAndToken t = fromMaybe (Nothing, t) $ do
|
||||||
(T_SimpleCommand _ _ (w:rest)) <- getCommand t
|
(T_SimpleCommand _ _ (w:rest)) <- getCommand t
|
||||||
s <- getLiteralString w
|
s <- getLiteralString w
|
||||||
if "busybox" `isSuffixOf` s || "builtin" == s
|
return $ case rest of
|
||||||
then
|
(applet:_) | "busybox" `isSuffixOf` s || "builtin" == s ->
|
||||||
case rest of
|
(getLiteralString applet, applet)
|
||||||
(applet:_) -> return (getLiteralString applet, applet)
|
_ ->
|
||||||
_ -> return (Just s, w)
|
(Just s, w)
|
||||||
else
|
|
||||||
return (Just s, w)
|
|
||||||
|
|
||||||
|
|
||||||
-- If a command substitution is a single command, get its name.
|
-- If a command substitution is a single command, get its name.
|
||||||
|
|
Loading…
Reference in New Issue