-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incrementally display output of
eval
commands
Rather than waiting for the process to complete and then displaying its output, `patat` now fetches the `stdout` and `stderr` as it becomes available and refreshes the display. This means that by default, **stderr is now displayed as well**. To disable displaying `stderr`, you can add `stderr: false` to the eval configuration, e.g.: ```yaml patat: eval: bash: command: bash stderr: false ```
- Loading branch information
Showing
16 changed files
with
395 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module Patat.Eval.Internal | ||
( EvalBlocks | ||
, EvalBlock (..) | ||
, renderEvalBlock | ||
) where | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
import qualified Control.Concurrent.Async as Async | ||
import qualified Data.HashMap.Strict as HMS | ||
import qualified Data.Text as T | ||
import Patat.Presentation.Instruction | ||
import Patat.Presentation.Settings | ||
import qualified Text.Pandoc as Pandoc | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
type EvalBlocks = HMS.HashMap Var EvalBlock | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
-- | Block that needs to be evaluated. | ||
data EvalBlock = EvalBlock | ||
{ ebSettings :: !EvalSettings | ||
, ebAttr :: !Pandoc.Attr | ||
, ebInput :: !T.Text | ||
, ebAsync :: !(Maybe (Async.Async ())) | ||
} | ||
|
||
|
||
-------------------------------------------------------------------------------- | ||
renderEvalBlock :: EvalBlock -> T.Text -> [Pandoc.Block] | ||
renderEvalBlock EvalBlock {..} out = case evalContainer ebSettings of | ||
EvalContainerCode -> [Pandoc.CodeBlock ebAttr out] | ||
EvalContainerNone -> [Pandoc.RawBlock fmt out] | ||
EvalContainerInline -> [Pandoc.Plain [Pandoc.RawInline fmt out]] | ||
where | ||
fmt = "eval" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.