summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Main.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 32afb6a..9bc09ff 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -12,17 +12,19 @@ import Data.Aeson (eitherDecode, encode)
import Data.Aeson.Encode.Pretty (encodePretty)
import Data.Aeson.KeyMap (coercionToHashMap)
import qualified Data.ByteString.Lazy as LB
-import qualified Data.Text.Encoding as T
-import qualified Data.Text.IO as T
import Data.Maybe (fromMaybe)
+import qualified Data.Text.Encoding as T
+import qualified Data.Text.IO as T
import System.Exit (ExitCode (..), exitWith)
import WithCli
import CheckDir (recursiveCheckDir, resultIsFatal)
+import Control.Monad (when)
import LintConfig (LintConfig (..), patchConfig)
import System.IO (hPutStrLn, stderr)
import Types (Level (..))
import Util (printPretty)
+import qualified Version as V (version)
import WriteRepo (writeAdjustedRepository)
-- | the options this cli tool can take
@@ -43,6 +45,7 @@ data Options = Options
-- ^ path to a config file. Currently required.
, config :: Maybe (LintConfig Maybe)
-- ^ a "patch" for the configuration file
+ , version :: Bool
} deriving (Show, Generic, HasArguments)
@@ -53,6 +56,10 @@ run :: Options -> IO ()
run options = do
aesonWarning
+ when (version options) $ do
+ putStrLn V.version
+ exitWith ExitSuccess
+
let repo = fromMaybe "." (repository options)
let entry = fromMaybe "main.json" (entrypoint options)
let level = fromMaybe Suggestion (lintlevel options)