From c05bd816e77e6f74b015516af7ade69e8652d6e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Fri, 6 Mar 2015 19:46:56 +0100 Subject: [PATCH] Add quiet option to decrease log level --- Language/Haskell/GhcMod.hs | 1 + Language/Haskell/GhcMod/Logging.hs | 4 ++++ src/GHCMod.hs | 7 ++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Language/Haskell/GhcMod.hs b/Language/Haskell/GhcMod.hs index b9a1976..68d26f9 100644 --- a/Language/Haskell/GhcMod.hs +++ b/Language/Haskell/GhcMod.hs @@ -12,6 +12,7 @@ module Language.Haskell.GhcMod ( -- * Logging , GmLogLevel , increaseLogLevel + , decreaseLogLevel , gmSetLogLevel , gmLog -- * Types diff --git a/Language/Haskell/GhcMod/Logging.hs b/Language/Haskell/GhcMod/Logging.hs index 9a089b1..26a7205 100644 --- a/Language/Haskell/GhcMod/Logging.hs +++ b/Language/Haskell/GhcMod/Logging.hs @@ -40,6 +40,10 @@ increaseLogLevel :: GmLogLevel -> GmLogLevel increaseLogLevel l | l == maxBound = l increaseLogLevel l = succ l +decreaseLogLevel :: GmLogLevel -> GmLogLevel +decreaseLogLevel l | l == minBound = l +decreaseLogLevel l = succ l + -- | -- >>> Just GmDebug <= Nothing -- False diff --git a/src/GHCMod.hs b/src/GHCMod.hs index 3aa5108..b086a9a 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -263,9 +263,14 @@ reqArg udsc dsc = ReqArg dsc udsc globalArgSpec :: [OptDescr (Options -> Options)] globalArgSpec = [ option "v" ["verbose"] "Can be given multiple times to be increasingly\ - \more verbose." $ + \ be more verbose." $ NoArg $ \o -> o { logLevel = increaseLogLevel (logLevel o) } + , option "q" [] "Can be given multiple times to be increasingly be less\ + \ verbose." $ + NoArg $ \o -> o { logLevel = decreaseLogLevel (logLevel o) } + + , option "l" ["tolisp"] "Format output as an S-Expression" $ NoArg $ \o -> o { outputStyle = LispStyle }