Skip to content

Conversation

thoughtpolice
Copy link
Member

This is useful for omitting OSC escape codes in templates; #7592

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes

This is useful for omitting OSC escape codes in templates; #7592

Signed-off-by: Austin Seipp <[email protected]>
@thoughtpolice thoughtpolice requested a review from a team as a code owner October 9, 2025 22:08
@thoughtpolice
Copy link
Member Author

I don't particularly love the name, btw. Maybe is_stdout_terminal is better?

"is_terminal_output",
|_language, _diagnostics, _build_ctx, function| {
function.expect_no_arguments()?;
let is_terminal = io::stdout().is_terminal();
Copy link
Contributor

Choose a reason for hiding this comment

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

Since template output may be written into file (when rendering commit description template for example), we should test if the output stream/formatter is terminal (or colored.) However, the templater doesn't know about the output stream. Maybe we can inject is_terminal context variable by TemplateRenderer, but I don't know how many terminal-related flags should be provided. Currently, there's just colored or not.

Another option is to rename this function to something like is_stdout_terminal to clarify that it is useless when rendering description templates.

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.

2 participants