import System.Environment
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter


printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"


main = do
    params <- getArgs
    case length params of
        0 -> printUsage
        _ -> do 
            let fileName = head params
            content <- readFile fileName

            let config = parse configFile fileName content
            case config of
                Left error -> print error
                Right (Config decls) -> sequence_ $ map (printLintMessage content) $ lint decls

import System.Environment
import System.Exit
import Text.Parsec
import Text.Parsec.Error
import NgLint.Parser
import NgLint.Linter


printUsage :: IO ()
printUsage = putStrLn "usage: nglint file.conf"


main = do
    params <- getArgs
    case length params of
        0 -> printUsage
        _ -> do 
            let fileName = head params
            content <- readFile fileName

            let config = parse configFile fileName content
            case config of
                Left error -> do
                    print error
                    exitFailure
                Right (Config decls) ->
                    if null messages
                        then exitSuccess
                        else do
                            sequence_ $ map (printLintMessage content) messages
                            exitFailure
                    where messages = lint decls

Use proper failure codes for executable
Use proper failure codes for executable
