on master help sign in
withSpinner: Use Text to be consistent
commita9dce84ccb59cfa42911315a58763b36a3df8273 authorSridhar Ratnakumar <srid@srid.ca> dateThu 10 May 2018, 18:55 (8 years ago) parentc35b66e
4 files changed+7−9
lib/command/src/Obelisk/App.hs−2 lib/command/src/Obelisk/Command/CLI.hs+5−5 lib/command/src/Obelisk/Command/Nix.hs+1−1 lib/command/src/Obelisk/Command/Thunk.hs+1−1
lib/command/src/Obelisk/App.hs−2
@@ -1,13 +1,11 @@
11{-# LANGUAGE ConstraintKinds #-}
22{-# LANGUAGE FlexibleContexts #-}
33{-# LANGUAGE MultiParamTypeClasses #-}
4−{-# LANGUAGE StaticPointers #-}
54module Obelisk.App where
65
76import Control.Monad.Catch (MonadMask)
87import Control.Monad.Reader (MonadIO, MonadReader)
98
10−-- TODO: Add configuration for logging, etc. here.
119data Obelisk = Obelisk
1210 { _obelisk_verbose :: Bool
1311 }
lib/command/src/Obelisk/Command/CLI.hs+5−5
@@ -24,8 +24,8 @@ import Obelisk.App (MonadObelisk, _obelisk_verbose)
2424-- singleton spinner thread and interact with it in order to print something.
2525withSpinner
2626 :: MonadObelisk m
27− => String -- ^ Text to print alongside the spinner
28− -> Maybe String -- ^ Optional text to print at the end
27+ => Text -- ^ Text to print alongside the spinner
28+ -> Maybe Text -- ^ Optional text to print at the end
2929 -> m a -- ^ Action to run and wait for
3030 -> m a
3131withSpinner s e f = do
@@ -36,14 +36,14 @@ withSpinner s e f = do
3636 let spinnerDisabled = not isTerm || inBashCompletion || verbose
3737 case spinnerDisabled of
3838 True -> do
39− putInfo $ T.pack s
39+ putInfo s
4040 f
4141 False -> do
42− spinner <- liftIO $ dots1Spinner (1000 * 200) s
42+ spinner <- liftIO $ dots1Spinner (1000 * 200) $ T.unpack s
4343 result <- finally f $ do
4444 liftIO $ stopIndicator spinner
4545 case e of
46− Just exitMsg -> putInfo $ T.pack exitMsg
46+ Just exitMsg -> putInfo exitMsg
4747 Nothing -> liftIO $ hFlush stdout
4848 return result
4949
lib/command/src/Obelisk/Command/Nix.hs+1−1
@@ -67,7 +67,7 @@ nixBuild cfg = do
6767 { std_out = CreatePipe
6868 , std_err = CreatePipe
6969 }
70− let msg = "Running nix-build [" <> _target_path (_nixBuildConfig_target cfg) <> "] ..."
70+ let msg = T.pack $ "Running nix-build [" <> _target_path (_nixBuildConfig_target cfg) <> "] ..."
7171 withSpinner msg Nothing $ do
7272 liftIO $ waitForProcess p >>= \case
7373 ExitSuccess -> return ()
lib/command/src/Obelisk/Command/Thunk.hs+1−1
@@ -469,7 +469,7 @@ unpackThunk thunkDir = readThunk thunkDir >>= \case
469469 githubURI <- liftIO $ either throwIO (return . repoSshUrl) repoResult >>= \case
470470 Nothing -> failWith "Cannot determine clone URI for thunk source"
471471 Just c -> return $ T.unpack $ getUrl c
472− withSpinner "Cloning from GitHub ..." (Just $ "Cloned " <> githubURI) $ do
472+ withSpinner "Cloning from GitHub ..." (Just $ "Cloned " <> T.pack githubURI) $ do
473473 liftIO $ callProcess "hub" --TODO: Depend on hub explicitly
474474 [ "clone"
475475 , "-n"