Skip to content

Few tweaks around CLI colors#3065

Merged
stgraber merged 3 commits intolxc:mainfrom
bensmrs:colors
Mar 23, 2026
Merged

Few tweaks around CLI colors#3065
stgraber merged 3 commits intolxc:mainfrom
bensmrs:colors

Conversation

@bensmrs
Copy link
Copy Markdown
Contributor

@bensmrs bensmrs commented Mar 23, 2026

Related-to: #3058

bensmrs added 2 commits March 23, 2026 08:55
This prevents error messages which are used in `(skipped:...)` lines to
be incorrectly rendered, as the `color` module resets all formatting
after printing. This led the end of the `(skipped:...)` line to show in
plain instead of dimmed colors.

Signed-off-by: Benjamin Somers <[email protected]>
@bensmrs bensmrs requested a review from stgraber as a code owner March 23, 2026 11:42
@stgraber
Copy link
Copy Markdown
Member

As mentioned in #3058 we'll want to move the flag to the Defaults section.
Otherwise this is looking good!

Comment on lines +43 to +45

// ShowColors controls whether colors are shown in the client.
ShowColors string `yaml:"show_colors"`
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.

The way it's worded, I'd expect it to be a boolean, but that would then default to False which isn't really what we want here :)

Alternatives could be Colors which would be a string value that can be used to change the color scheme or turn them off entirely. Or NoColors which would then be a boolean in line with the behavior of NO_COLORS in the environment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I’m not particularly in the mood to implement a color scheme manager :)
Regarding the fact that it’s a not a boolean, that was exactly the line of reasoning behind it. Additionally, YAML booleans do not conform 1:1 to what Incus parses as booleans (0 and 1 don’t seem to get a special downcasting), but we can disregard that.

So, NoColors bool `yaml:"no_colors"` then?

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.

sounds good to me

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, the env var is NO_COLOR and the related movement is https://no-color.org, so let’s go singular.

Signed-off-by: Benjamin Somers <[email protected]>
@stgraber stgraber enabled auto-merge March 23, 2026 22:26
@stgraber stgraber merged commit fcfd161 into lxc:main Mar 23, 2026
104 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants