summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 41f5da6..5072a64 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -17,6 +17,7 @@ import WithCli
import Util (printPretty)
import CheckDir (recursiveCheckDir)
+import Types (Level(..))
-- | the options this cli tool can take
data Options = Options
@@ -26,10 +27,10 @@ data Options = Options
-- ^ entrypoint in that repository
, allowScripts :: Bool
-- ^ pass --allowScripts to allow javascript in map
- , scriptInject :: Maybe String
- -- ^ optional filepath to javascript that should be injected
, json :: Bool
-- ^ emit json if --json was given
+ , lintlevel :: Maybe Level
+ -- ^ maximum lint level to print
, pretty :: Bool
-- ^ pretty-print the json to make it human-readable
} deriving (Show, Generic, HasArguments)
@@ -42,13 +43,14 @@ run :: Options -> IO ()
run options = do
let repo = fromMaybe "." (repository options)
let entry = fromMaybe "main.json" (entrypoint options)
+ let level = fromMaybe Suggestion (lintlevel options)
lints <- recursiveCheckDir repo entry
if json options
then printLB
$ if pretty options then encodePretty lints else encode lints
- else printPretty lints
+ else printPretty (level, lints)
-- | haskell's many string types are FUN …
printLB :: LB.ByteString -> IO ()