From b136609cb5adb48a994ec81df0b91d98e73c1be6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Nov 2014 21:20:19 -0400 Subject: unicode ahoy --- src/Propellor/Message.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Message.hs') diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index a1e510ab..a5d4d2ca 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -59,6 +59,7 @@ actionMessage' mhn desc a = do liftIO $ do whenConsole h $ setTitle "propellor: running" + putStr propellorSigel showhn h mhn putStr $ desc ++ " ... " let (msg, intensity, color) = getActionResult r @@ -78,12 +79,12 @@ actionMessage' mhn desc a = do warningMessage :: MonadIO m => String -> m () warningMessage s = liftIO $ do h <- mkMessageHandle - colorLine h Vivid Magenta $ "** warning: " ++ s + colorLine h Vivid Magenta $ propellorSigel ++ "** warning: " ++ s errorMessage :: MonadIO m => String -> m a errorMessage s = liftIO $ do h <- mkMessageHandle - colorLine h Vivid Red $ "** error: " ++ s + colorLine h Vivid Red $ propellorSigel ++ "** error: " ++ s error "Cannot continue!" colorLine :: MessageHandle -> ColorIntensity -> Color -> String -> IO () @@ -112,3 +113,7 @@ checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG" updateGlobalLogger rootLoggerName $ setLevel DEBUG . setHandlers [f] go _ = noop + +-- Unicode propellor. +propellorSigel :: String +propellorSigel = "ꕤ " -- cgit v1.3-2-g0d8e From d130e7e628568be9593474fbe5601239c6ce8a2e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Nov 2014 21:48:48 -0400 Subject: propellor spin --- src/Propellor/Git.hs | 3 ++- src/Propellor/Message.hs | 11 +++++++---- src/Propellor/Server.hs | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Message.hs') diff --git a/src/Propellor/Git.hs b/src/Propellor/Git.hs index 88d5c3ab..73de1def 100644 --- a/src/Propellor/Git.hs +++ b/src/Propellor/Git.hs @@ -69,7 +69,8 @@ fetchOrigin = do branchref <- getCurrentBranch let originbranch = "origin" branchref - void $ actionMessage "Git fetch" $ boolSystem "git" [Param "fetch"] + void $ actionMessage "Pull from central git repository" $ + boolSystem "git" [Param "fetch"] oldsha <- getCurrentGitSha1 branchref diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index a5d4d2ca..244913ea 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -15,16 +15,19 @@ import Control.Applicative import Propellor.Types import Utility.Monad import Utility.Env +import Utility.FileSystemEncoding data MessageHandle = ConsoleMessageHandle | TextMessageHandle mkMessageHandle :: IO MessageHandle -mkMessageHandle = ifM (hIsTerminalDevice stdout <||> (isJust <$> getEnv "PROPELLOR_CONSOLE")) - ( return ConsoleMessageHandle - , return TextMessageHandle - ) +mkMessageHandle = do + fileEncoding stdout + ifM (hIsTerminalDevice stdout <||> (isJust <$> getEnv "PROPELLOR_CONSOLE")) + ( return ConsoleMessageHandle + , return TextMessageHandle + ) forceConsole :: IO () forceConsole = void $ setEnv "PROPELLOR_CONSOLE" "1" True diff --git a/src/Propellor/Server.hs b/src/Propellor/Server.hs index 182cc2b5..513a81f4 100644 --- a/src/Propellor/Server.hs +++ b/src/Propellor/Server.hs @@ -20,7 +20,7 @@ import Utility.FileMode import Utility.SafeCommand -- Update the privdata, repo url, and git repo over the ssh --- connection, talking the the user's local propellor instance which is +-- connection, talking to the user's local propellor instance which is -- running the updateServer update :: IO () update = do -- cgit v1.3-2-g0d8e From 7c11d6801865a75af98dff0209b09a642d813411 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Nov 2014 21:50:49 -0400 Subject: propellor spin --- src/Propellor/Message.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/Propellor/Message.hs') diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index 244913ea..7e386541 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -15,7 +15,6 @@ import Control.Applicative import Propellor.Types import Utility.Monad import Utility.Env -import Utility.FileSystemEncoding data MessageHandle = ConsoleMessageHandle @@ -23,7 +22,6 @@ data MessageHandle mkMessageHandle :: IO MessageHandle mkMessageHandle = do - fileEncoding stdout ifM (hIsTerminalDevice stdout <||> (isJust <$> getEnv "PROPELLOR_CONSOLE")) ( return ConsoleMessageHandle , return TextMessageHandle @@ -117,6 +115,5 @@ checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG" setLevel DEBUG . setHandlers [f] go _ = noop --- Unicode propellor. propellorSigel :: String -propellorSigel = "ꕤ " +propellorSigel = "* " -- cgit v1.3-2-g0d8e From b7d78e679ab94a93732f48f4446c1b55bf3dae32 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 19 Nov 2014 21:51:52 -0400 Subject: sigel didn't work out Unicode output failed in docker, due to no locales, and would be generally shakey from haskell in all the environments propellor needs to run in. --- src/Propellor/Message.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/Propellor/Message.hs') diff --git a/src/Propellor/Message.hs b/src/Propellor/Message.hs index 7e386541..09a92538 100644 --- a/src/Propellor/Message.hs +++ b/src/Propellor/Message.hs @@ -60,7 +60,6 @@ actionMessage' mhn desc a = do liftIO $ do whenConsole h $ setTitle "propellor: running" - putStr propellorSigel showhn h mhn putStr $ desc ++ " ... " let (msg, intensity, color) = getActionResult r @@ -80,12 +79,12 @@ actionMessage' mhn desc a = do warningMessage :: MonadIO m => String -> m () warningMessage s = liftIO $ do h <- mkMessageHandle - colorLine h Vivid Magenta $ propellorSigel ++ "** warning: " ++ s + colorLine h Vivid Magenta $ "** warning: " ++ s errorMessage :: MonadIO m => String -> m a errorMessage s = liftIO $ do h <- mkMessageHandle - colorLine h Vivid Red $ propellorSigel ++ "** error: " ++ s + colorLine h Vivid Red $ "** error: " ++ s error "Cannot continue!" colorLine :: MessageHandle -> ColorIntensity -> Color -> String -> IO () @@ -114,6 +113,3 @@ checkDebugMode = go =<< getEnv "PROPELLOR_DEBUG" updateGlobalLogger rootLoggerName $ setLevel DEBUG . setHandlers [f] go _ = noop - -propellorSigel :: String -propellorSigel = "* " -- cgit v1.3-2-g0d8e