Skip to content

Commit

Permalink
Improve transcript runner output
Browse files Browse the repository at this point in the history
Previously, it would output messages like

    ⚙️   Processing stanza Just 6 of 7.

and

    ⚙️   Processing stanza Nothing of 7.

which was especially confusing when there was text or some other
non-Unison block at the end of the transcript.

Now the messages look like

    ⏩   Skipping non-executable Markdown block.
    ⚙️   Processing stanza 6 of 7.
    ✔️   Completed transcript.

The one shortcoming is that I don’t know how to clear the line after the
carriage return, so I added whitespace padding to make sure the previous
messages get overwritten.
  • Loading branch information
sellout committed Aug 20, 2024
1 parent e388786 commit 85f147f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions unison-cli/src/Unison/Codebase/Transcript/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,21 @@ run isTest verbosity dir stanzas codebase runtime sbRuntime nRuntime config ucmV
_ <- liftIO (writeIORef mStanza maybeStanza)
case maybeStanza of
Nothing -> do
liftIO (putStrLn "")
liftIO (putStrLn "\r✔️ Completed transcript. ")
pure $ Right QuitI
Just (s, idx) -> do
Just (s, midx) -> do
unless (Verbosity.isSilent verbosity) . liftIO $ do
putStr $
"\r⚙️ Processing stanza "
++ show idx
++ " of "
++ show (length stanzas)
++ "."
maybe
"\r⏩ Skipping non-executable Markdown block."
( \idx ->
"\r⚙️ Processing stanza "
++ show idx
++ " of "
++ show (length stanzas)
++ ". "
)
midx
IO.hFlush IO.stdout
either
( \node -> do
Expand Down

0 comments on commit 85f147f

Please sign in to comment.