From 025cc5266ec1632d5f524644f0366237f604e7e8 Mon Sep 17 00:00:00 2001 From: "Joseph C. Sible" Date: Mon, 1 Jan 2024 16:00:19 -0500 Subject: [PATCH] Simplify isUnquotedFlag --- src/ShellCheck/ASTLib.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ShellCheck/ASTLib.hs b/src/ShellCheck/ASTLib.hs index 9b151c2dd..88089ea22 100644 --- a/src/ShellCheck/ASTLib.hs +++ b/src/ShellCheck/ASTLib.hs @@ -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