add verbose flag parser

This commit is contained in:
Meisam 2022-11-16 16:59:22 +01:00 committed by GitHub
commit c4873f36aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -74,7 +74,8 @@ data Options = Options {
externalSources :: Bool,
sourcePaths :: [FilePath],
formatterOptions :: FormatterOptions,
minSeverity :: Severity
minSeverity :: Severity,
verbose :: Bool
}
defaultOptions = Options {
@ -84,7 +85,8 @@ defaultOptions = Options {
formatterOptions = newFormatterOptions {
foColorOption = ColorAuto
},
minSeverity = StyleC
minSeverity = StyleC,
verbose = False
}
usageHeader = "Usage: shellcheck [OPTIONS...] FILES..."
@ -117,6 +119,8 @@ options = [
Option "S" ["severity"]
(ReqArg (Flag "severity") "SEVERITY")
"Minimum severity of errors to consider (error, warning, info, style)",
Option "v" ["vebose"]
(NoArg $ Flag "verbose" "true") "Verbose mode",
Option "V" ["version"]
(NoArg $ Flag "version" "true") "Print version information",
Option "W" ["wiki-link-count"]
@ -304,6 +308,11 @@ parseOption flag options =
}
}
Flag "verbose" _ ->
return options {
verbose = True
}
Flag "version" _ -> do
liftIO printVersion
throwError NoProblems