on master help sign in
Get rid of multiwayif
commit3ea07aa73ad5ec7e28ac10059c2429c4ed90f3e0 authorSridhar Ratnakumar <srid@srid.ca> dateThu 10 May 2018, 12:08 (8 years ago) parent405c7fa
1 file changed+4−3
lib/command/src/Obelisk/Command/CLI.hs+4−3
lib/command/src/Obelisk/Command/CLI.hs+4−3
@@ -1,5 +1,4 @@
11{-# LANGUAGE LambdaCase #-}
2−{-# LANGUAGE MultiWayIf #-}
32module Obelisk.Command.CLI where
43
54import Control.Exception (finally)
@@ -27,8 +26,9 @@ withSpinner s e f = do
2726 isTerm <- hIsTerminalDevice stdout
2827 -- When running in shell completion, disable the spinner. TODO: Do this using ReaderT and config.
2928 inBashCompletion <- isInfixOf "completion" . unwords <$> getArgs
30− if | not isTerm || inBashCompletion -> f
31− | otherwise -> do
29+ case not isTerm || inBashCompletion of
30+ True -> f
31+ False -> do
3232 spinner <- dots1Spinner (1000 * 200) s
3333 result <- finally f $ do
3434 stopIndicator spinner
@@ -38,6 +38,7 @@ withSpinner s e f = do
3838 return result
3939
4040data Level = Level_Normal | Level_Warning | Level_Error
41+ deriving (Bounded, Enum, Eq, Ord, Show)
4142
4243-- TODO: Handle this error cleanly when evaluating outside of `withSpinner` (eg: runCLI)
4344failWith :: Text -> IO a