Skip to content

Fix: use MarkdownConsole in non-interactive contexts#4306

Merged
treysp merged 7 commits intomainfrom
trey/mkdown-cli-console
May 7, 2025
Merged

Fix: use MarkdownConsole in non-interactive contexts#4306
treysp merged 7 commits intomainfrom
trey/mkdown-cli-console

Conversation

@treysp
Copy link
Contributor

@treysp treysp commented May 2, 2025

Some terminals do not support unicode emoji like those used in the standard CLI output (e.g., running SQLMesh with Powershell.exe in Github Actions). Using the MarkdownConsole instead of standard TerminalConsole addresses this problem.

There is not a universal way to determine whether a given terminal supports Unicode, so we instead assume that unicode is not needed in any non-interactive context (typically a CI platform).

This PR:

  • Automatically detects if we're in a non-interactive context and uses MarkdownConsole if so
    • Non-interactive contexts include CI (detected via env vars commonly set by CI systems) or anywhere stdout and stdin are not both tty
  • Brings the MarkdownConsole output into alignment with recent CLI updates
  • Allows the user to force terminal output of any runtime environment with the SQLMESH_RUNTIME_ENVIRONMENT env var
    • Accepted values: terminal, databricks, google_colab, jupyter, debugger, non_interactive, ci

Screenshot 2025-05-02 at 5 27 38 PM

@treysp treysp force-pushed the trey/mkdown-cli-console branch from 4ac14f7 to f5a3725 Compare May 2, 2025 21:24
@treysp treysp force-pushed the trey/mkdown-cli-console branch 9 times, most recently from 615046e to a9685ba Compare May 7, 2025 20:10
@treysp treysp force-pushed the trey/mkdown-cli-console branch from a9685ba to 1deb3f6 Compare May 7, 2025 20:53
@treysp treysp marked this pull request as ready for review May 7, 2025 21:16
@treysp treysp force-pushed the trey/mkdown-cli-console branch from 9861b6b to 9745d22 Compare May 7, 2025 21:32
@treysp treysp merged commit 894bc78 into main May 7, 2025
23 checks passed
@treysp treysp deleted the trey/mkdown-cli-console branch May 7, 2025 21:57
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