blob: 4a8a4d310cf73221064983f5cba4fc603044874c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
-- | This is a very simple project containing a few code style checks for use
-- in git hooks for the Snap Framework. Hopefully we'll get some more
-- sophisticated checks and automatic fixes implemented eventually.
module Main
( main
) where
import Control.Applicative ((<$>))
import System.Environment (getArgs)
import System.Exit (ExitCode (..), exitWith)
import HStyle
-- | Simple main that takes one command-line parameter of "check" or "fix" and
-- a list of files to be checked.
main :: IO ()
main = do
args <- getArgs
case args of
"check" : files -> do
ok <- and <$> mapM checkStyle files
exitWith $ if ok then ExitSuccess else ExitFailure 1
"fix" : files -> mapM_ fixStyle files
_ -> error "Must specify 'check' or 'fix'"
|