mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 13:31:36 -07:00
Merge pull request #2119 from josephcsible/refactors
Various refactorings
This commit is contained in:
commit
15ff87cf80
6 changed files with 28 additions and 35 deletions
|
@ -178,7 +178,7 @@ getOpts (gnu, arbitraryLongOpts) string longopts args = process args
|
|||
process [] = return []
|
||||
process (token:rest) = do
|
||||
case getLiteralStringDef "\0" token of
|
||||
'-':'-':[] -> return $ listToArgs rest
|
||||
"--" -> return $ listToArgs rest
|
||||
'-':'-':word -> do
|
||||
let (name, arg) = span (/= '=') word
|
||||
needsArg <-
|
||||
|
@ -466,7 +466,7 @@ getCommandNameAndToken direct t = fromMaybe (Nothing, t) $ do
|
|||
"run" -> firstArg -- Used by bats
|
||||
"exec" -> do
|
||||
opts <- getBsdOpts "cla:" args
|
||||
(_, (t, _)) <- listToMaybe $ filter (null . fst) opts
|
||||
(_, (t, _)) <- find (null . fst) opts
|
||||
return t
|
||||
_ -> fail ""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue