From 7e77e6335bab772c4be1b3f0594113d09cd4a366 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Thu, 23 Sep 2021 03:01:09 +0200 Subject: handle all maps in entire repositories (+ checking that paths don't run outside of respositories) --- src/Main.hs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index 33db91c..41f5da6 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -15,16 +15,15 @@ import Data.Text.Lazy as T import System.IO (utf8) import WithCli -import CheckMap (loadAndLintMap) import Util (printPretty) import CheckDir (recursiveCheckDir) -- | the options this cli tool can take data Options = Options - { inpath :: Maybe String - -- ^ path to input map files - , outpath :: Maybe String - -- ^ path to out directory (should be empty) + { repository :: Maybe String + -- ^ path to the repository containing maps to lint + , entrypoint :: Maybe String + -- ^ entrypoint in that repository , allowScripts :: Bool -- ^ pass --allowScripts to allow javascript in map , scriptInject :: Maybe String @@ -41,8 +40,10 @@ main = withCli run run :: Options -> IO () run options = do - --lints <- loadAndLintMap (fromMaybe "example.json" (inpath options)) - lints <- recursiveCheckDir (fromMaybe "example.json" (inpath options)) + let repo = fromMaybe "." (repository options) + let entry = fromMaybe "main.json" (entrypoint options) + + lints <- recursiveCheckDir repo entry if json options then printLB -- cgit v1.2.3