githud 3.1.0 → 3.2.0
raw patch · 3 files changed
+33/−7 lines, 3 filesdep +temporaryPVP ok
version bump matches the API change (PVP)
Dependencies added: temporary
API changes (from Hackage documentation)
Files
- githud.cabal +4/−3
- src/GitHUD/Config/Types.hs +7/−2
- src/GitHUD/Debug.hs +22/−2
githud.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: githud-version: 3.1.0+version: 3.2.0 synopsis: Heads up, and you see your GIT context description: GIT Heads Up Display for your terminal prompt. More efficient replacement to the great git-radar. Please see README.md for more info homepage: http://github.com/gbataille/gitHUD#readme@@ -38,11 +38,12 @@ , daemons >= 0.2.1 && < 0.3 , data-default >= 0.7 && < 0.8 , directory >= 1.3 && < 1.4- , process- , parsec >= 3.1.13 && < 4 , mtl >= 2.2.2 && < 3 , network >= 2.8 && < 3.0+ , parsec >= 3.1.13 && < 4+ , process , text >= 1.2 && < 1.3+ , temporary >= 1.3 && < 2 , unix >= 2.7 && < 3 , utf8-string >= 1.0 && < 1.1 default-language: Haskell2010
src/GitHUD/Config/Types.hs view
@@ -3,6 +3,8 @@ , defaultConfig ) where +import System.IO.Temp (getCanonicalTemporaryDirectory)+import System.IO.Unsafe (unsafePerformIO) import System.Posix.Daemon (Redirection(DevNull, ToFile)) import GitHUD.Terminal.Types@@ -91,6 +93,9 @@ , confGithuddLogFilePath :: Redirection } deriving (Eq, Show) +tempDir :: String+tempDir = unsafePerformIO getCanonicalTemporaryDirectory+ defaultConfig :: Config defaultConfig = Config { confShowPartRepoIndicator = True@@ -164,8 +169,8 @@ , confRunFetcherDaemon = True , confGithuddSleepSeconds = 30- , confGithuddPidFilePath = "/usr/local/var/run/githudd.pid"- , confGithuddSocketFilePath = "/usr/local/var/run/githudd.socket"+ , confGithuddPidFilePath = tempDir ++ "/githudd.pid"+ , confGithuddSocketFilePath = tempDir ++ "/githudd.socket" , confGithuddLogFilePath = DevNull }
src/GitHUD/Debug.hs view
@@ -3,16 +3,36 @@ debugOnStderr ) where +import Control.Monad (when)+import Data.Maybe (fromMaybe)+import System.Environment (lookupEnv) import System.IO (stdout, stderr, hFlush, hPutStrLn) +debugEnvVar :: String+debugEnvVar = "GITHUD_DEBUG"++debugEnvVarValue :: String+debugEnvVarValue = "TRUE"++isDebugActive :: IO Bool+isDebugActive = do+ env <- lookupEnv debugEnvVar+ let debug = fromMaybe "FALSE" env+ return $ debug == debugEnvVarValue++whenDebugActive :: IO () -> IO ()+whenDebugActive effect = do+ debugActive <- isDebugActive+ if debugActive then effect else return ()+ debug :: String -> IO ()-debug msg = do+debug msg = whenDebugActive $ do putStrLn msg hFlush stdout debugOnStderr :: String -> IO ()-debugOnStderr msg = do+debugOnStderr msg = whenDebugActive $ do hPutStrLn stderr msg hFlush stderr