mirror of
https://github.com/github/semantic.git
synced 2025-01-02 12:23:08 +03:00
New flag to log paths
This commit is contained in:
parent
3d8fbead61
commit
fb885ccd1d
@ -57,7 +57,7 @@ main = do
|
|||||||
(options, task) <- customExecParser (prefs showHelpOnEmpty) arguments
|
(options, task) <- customExecParser (prefs showHelpOnEmpty) arguments
|
||||||
config <- defaultConfig options
|
config <- defaultConfig options
|
||||||
res <- withTelemetry config $ \ (TelemetryQueues logger statter _) ->
|
res <- withTelemetry config $ \ (TelemetryQueues logger statter _) ->
|
||||||
Task.runTask (Task.TaskSession config "-" False logger statter) task
|
Task.runTask (Task.TaskSession config "-" (optionsLogPathsOnError options) logger statter) task
|
||||||
either (die . displayException) pure res
|
either (die . displayException) pure res
|
||||||
|
|
||||||
-- | A parser for the application's command-line arguments.
|
-- | A parser for the application's command-line arguments.
|
||||||
@ -76,7 +76,8 @@ optionsParser = do
|
|||||||
(long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.")
|
(long "log-level" <> value (Just Log.Warning) <> help "Log messages at or above this level, or disable logging entirely.")
|
||||||
failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.")
|
failOnWarning <- switch (long "fail-on-warning" <> help "Fail on assignment warnings.")
|
||||||
failOnParseError <- switch (long "fail-on-parse-error" <> help "Fail on tree-sitter parse errors.")
|
failOnParseError <- switch (long "fail-on-parse-error" <> help "Fail on tree-sitter parse errors.")
|
||||||
pure $ Options logLevel (Flag.flag FailOnWarning failOnWarning) (Flag.flag FailOnParseError failOnParseError)
|
logPathsOnError <- switch (long "log-paths" <> help "Log source paths on parse and assignment error.")
|
||||||
|
pure $ Options logLevel logPathsOnError (Flag.flag FailOnWarning failOnWarning) (Flag.flag FailOnParseError failOnParseError)
|
||||||
|
|
||||||
argumentsParser :: Parser (Task.TaskEff ())
|
argumentsParser :: Parser (Task.TaskEff ())
|
||||||
argumentsParser = do
|
argumentsParser = do
|
||||||
|
@ -61,12 +61,13 @@ data Config
|
|||||||
data Options
|
data Options
|
||||||
= Options
|
= Options
|
||||||
{ optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disables logging.
|
{ optionsLogLevel :: Maybe Level -- ^ What level of messages to log. 'Nothing' disables logging.
|
||||||
|
, optionsLogPathsOnError :: Bool -- ^ Should semantic log source path on parse or assignment errors (default: False).
|
||||||
, optionsFailOnWarning :: Flag FailOnWarning -- ^ Should semantic fail fast on assignment warnings (for testing)
|
, optionsFailOnWarning :: Flag FailOnWarning -- ^ Should semantic fail fast on assignment warnings (for testing)
|
||||||
, optionsFailOnParseError :: Flag FailOnParseError -- ^ Should semantic fail fast on tree-sitter parser errors (for testing)
|
, optionsFailOnParseError :: Flag FailOnParseError -- ^ Should semantic fail fast on tree-sitter parser errors (for testing)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultOptions :: Options
|
defaultOptions :: Options
|
||||||
defaultOptions = Options (Just Warning) (flag FailOnWarning False) (flag FailOnParseError False)
|
defaultOptions = Options (Just Warning) False (flag FailOnWarning False) (flag FailOnParseError False)
|
||||||
|
|
||||||
debugOptions :: Options
|
debugOptions :: Options
|
||||||
debugOptions = defaultOptions { optionsLogLevel = Just Debug }
|
debugOptions = defaultOptions { optionsLogLevel = Just Debug }
|
||||||
|
Loading…
Reference in New Issue
Block a user