Skip to content

std: Move TTY from std.debug to std.io and add missing colors - #15806

Merged
Vexu merged 4 commits into
ziglang:masterfrom
linusg:std-io-tty
May 24, 2023
Merged

std: Move TTY from std.debug to std.io and add missing colors#15806
Vexu merged 4 commits into
ziglang:masterfrom
linusg:std-io-tty

Conversation

@linusg

Copy link
Copy Markdown
Collaborator

Closes#15804.

@linusg

Copy link
Copy Markdown
CollaboratorAuthor

I've pushed an update to make colors not bold by default (the ;1m), which kind of defeated the purpose of .bold. This affects compiler output, which I've decided to keep as-is. Basically, purposefully bold text actually stands out now - before and after:

image

image

@VexuVexu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could std.io.detectTTYConfig be std.io.TTY.detectConfig instead?

Comment threadlib/std/io/tty.zig Outdated
Comment threadlib/std/io/tty.zig Outdated
@linusg
linusg requested a review from VexuMay 23, 2023 22:21
linusg added 4 commits May 24, 2023 10:15
Also get rid of the TTY wrapper struct, which was exlusively used as a
namespace - this is done by the tty.zig root struct now.
detectTTYConfig has been renamed to just detectConfig, which is enough
given the new namespace. Additionally, a doc comment had been added.
Also make colors not bold by default, that's what .bold is for.
@Vexu
Vexu enabled auto-merge May 24, 2023 10:00
@Vexu
Vexu merged commit 7cb2e65 into ziglang:masterMay 24, 2023
@linusg
linusg deleted the std-io-tty branch May 24, 2023 13:24
Comment threadlib/std/io/tty.zig
// Per https://github.com/WebAssembly/WASI/issues/162 ANSI codes
// aren't currently supported.
return .no_color;
} else if (process.hasEnvVarConstant("ZIG_DEBUG_COLOR")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't feel right to introduce

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Purely moved, I didn't make any additions not mentioned in the proposal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks like @andrewrk added it in 05f1ea3 to force color while capturing compiler output for docgen.zig.

Sign up for freeto 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.

Proposal: Promote std.debug.TTY to non-debug functionality

5 participants

@linusg@andrewrk@daurnimator@ifreund@Vexu