Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render last frame only when there is no output TTY #669

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nickwesselman
Copy link

Fixes #667

Mirror existing CI behavior when there is no output TTY. This will enable the output of ink-based CLIs to gracefully pipe into other processes, such as pagers like more and less.

Also provides control over this behavior for CLIs which wish to support piping into processes that support ANSI deletion escapes.

Testing

Try some various uses of the Static example --

npm run example examples/static
npm run example examples/static | more
CI=1 npm run example examples/static 

@sindresorhus
Copy link
Collaborator

How about the name staticOutput instead?

@sindresorhus
Copy link
Collaborator

It needs to be added to the readme.

/**
* Configure whether Ink should only render the last frame of non-static output. Useful when ANSI erase codes are not supported.
*
* @default true if in CI or stdout is not a TTY
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@default should only receive an actual TS value, not a sentence. Just use Default: ... instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expected behavior when there is no output TTY
2 participants