Skip to content

Commit

Permalink
Simplify isUnquotedFlag
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Jan 1, 2024
1 parent 5a6f484 commit 025cc52
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ShellCheck/ASTLib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ isFlag token =
_ -> False

-- Is this token a flag where the - is unquoted?
isUnquotedFlag token = fromMaybe False $ do
str <- getLeadingUnquotedString token
return $ "-" `isPrefixOf` str
isUnquotedFlag token =
case getLeadingUnquotedString token of
Just ('-':_) -> True
_ -> False

-- getGnuOpts "erd:u:" will parse a list of arguments tokens like `read`
-- -re -d : -u 3 bar
Expand Down

0 comments on commit 025cc52

Please sign in to comment.