diff options
Diffstat (limited to '')
| -rw-r--r-- | src/Main.hs | 15 | 
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs index 9bc09ff..02e8f02 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -3,6 +3,7 @@  {-# LANGUAGE LambdaCase        #-}  {-# LANGUAGE NamedFieldPuns    #-}  {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE MultiWayIf #-}  module Main where @@ -18,7 +19,7 @@ import qualified Data.Text.IO             as T  import           System.Exit              (ExitCode (..), exitWith)  import           WithCli -import           CheckDir                 (recursiveCheckDir, resultIsFatal) +import           CheckDir                 (recursiveCheckDir, resultIsFatal, DirResult (dirresultGraph))  import           Control.Monad            (when)  import           LintConfig               (LintConfig (..), patchConfig)  import           System.IO                (hPutStrLn, stderr) @@ -26,6 +27,7 @@ import           Types                    (Level (..))  import           Util                     (printPretty)  import qualified Version                  as V (version)  import           WriteRepo                (writeAdjustedRepository) +import Text.Dot (showDot)  -- | the options this cli tool can take  data Options = Options @@ -46,6 +48,7 @@ data Options = Options    , config     :: Maybe (LintConfig Maybe)    -- ^ a "patch" for the configuration file    , version    :: Bool +  , dot        :: Bool    } deriving (Show, Generic, HasArguments) @@ -73,10 +76,12 @@ run options = do    lints <- recursiveCheckDir lintconfig repo entry -  if json options -    then printLB -    $ if pretty options then encodePretty lints else encode lints -    else printPretty (level, lints) +  if | dot options -> +       putStrLn (showDot $ dirresultGraph lints) +     | json options -> +       printLB +        $ if pretty options then encodePretty lints else encode lints +     | otherwise -> printPretty (level, lints)    case out options of      Nothing -> exitWith $ case resultIsFatal lintconfig lints of  | 
