Skip to content

Commit

Permalink
Implement parseEnum in terms of lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
josephcsible committed Dec 21, 2023
1 parent f983d9a commit dab77b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions shellcheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ runFormatter sys format options files = do
else SomeProblems

parseEnum name value list =
case filter ((== value) . fst) list of
[(name, value)] -> return value
[] -> do
case lookup value list of
Just value -> return value
Nothing -> do
printErr $ "Unknown value for --" ++ name ++ ". " ++
"Valid options are: " ++ (intercalate ", " $ map fst list)
throwError SupportFailure
Expand Down

0 comments on commit dab77b2

Please sign in to comment.