summaryrefslogtreecommitdiffhomepage
path: root/src/Main.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2012-06-05 08:55:59 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2012-06-05 08:55:59 +0200
commit7ac3d3b3eae45b9db69980bc8964f2d3fa37fe82 (patch)
tree4ce7709d35224e85912e517a42e61530df95c6a7 /src/Main.hs
parentcbe0f7bc5ddae7f546e525394c8095062e11ef0f (diff)
downloadstylish-haskell-7ac3d3b3eae45b9db69980bc8964f2d3fa37fe82.tar.gz
Add verbose flag
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 02027ab..241fe33 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -16,20 +16,23 @@ import System.Console.CmdArgs
import Paths_stylish_haskell (version)
import StylishHaskell
import StylishHaskell.Config
+import StylishHaskell.Verbose
--------------------------------------------------------------------------------
data StylishArgs = StylishArgs
- { config :: Maybe FilePath
- , files :: [FilePath]
+ { config :: Maybe FilePath
+ , verbose :: Bool
+ , files :: [FilePath]
} deriving (Data, Show, Typeable)
--------------------------------------------------------------------------------
stylishArgs :: StylishArgs
stylishArgs = StylishArgs
- { config = Nothing &= typFile &= help "Configuration file"
- , files = [] &= typFile &= args
+ { config = Nothing &= typFile &= help "Configuration file"
+ , verbose = False &= help "Run in verbose mode"
+ , files = [] &= typFile &= args
} &= summary ("stylish-haskell-" ++ versionString version)
where
versionString = intercalate "." . map show . versionBranch
@@ -39,8 +42,9 @@ stylishArgs = StylishArgs
main :: IO ()
main = do
sa <- cmdArgs stylishArgs
- conf <- loadConfig (config sa)
- let filePath = listToMaybe $ files sa
- stylish = configStylish conf
+ let verbose' = makeVerbose (verbose sa)
+ conf <- loadConfig verbose' (config sa)
+ let filePath = listToMaybe $ files sa
+ stylish = configStylish conf
contents <- maybe getContents readFile filePath
putStr $ unlines $ chainStylish filePath stylish $ lines contents