From cf63dbaa9435ae851e7da66b4f0648a2e0dd07aa Mon Sep 17 00:00:00 2001 From: voidlizard Date: Thu, 13 Feb 2025 10:58:43 +0300 Subject: [PATCH] better console output --- hbs2-git3/app/GitRemoteHelper.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hbs2-git3/app/GitRemoteHelper.hs b/hbs2-git3/app/GitRemoteHelper.hs index da84a809..7c8489dd 100644 --- a/hbs2-git3/app/GitRemoteHelper.hs +++ b/hbs2-git3/app/GitRemoteHelper.hs @@ -26,8 +26,10 @@ import Text.InterpolatedString.Perl6 (qc) import Data.Text qualified as Text import Data.Either import Data.Maybe +import Data.List qualified as List import Data.Config.Suckless.Script +import Data.Config.Suckless.System import System.Exit hiding (die) import System.Console.ANSI @@ -160,6 +162,9 @@ main = flip runContT pure do lift $ void $ installHandler sigPIPE Ignore Nothing cp_ <- newTVarIO Nothing + refz <- newTVarIO mempty + + -- doesPathExist ContT $ withAsync $ liftIO $ flip runContT pure do callCC \finished -> do @@ -200,7 +205,10 @@ main = flip runContT pure do when (isJust cp) do hPutDoc origHandle $ "fetched from checkpoint" <+> pretty ts <+> pretty cpHash <> line - hPutDoc origHandle $ "use" <+> yellow "git fetch" <+> "to get latest versions" <> line + new <- readTVarIO refz <&> List.null + + when new do + hPutDoc origHandle $ "use" <+> yellow "git fetch" <+> "to get latest versions" <> line hFlush origHandle @@ -241,6 +249,8 @@ main = flip runContT pure do for_ url updateRepoKey + importedRefs >>= atomically . writeTVar refz + flip fix Plain $ \next -> \case Plain -> do