microsoft / microsoft/knack

Can colorization of warnings be controlled?

Open
#302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Dear Knack team,

This is more of a question from Azure CLI, that use Knack.

When developing a provisioning script for my app that use Entra ID app registration and Azure resources I noticed that in some cases warnings was colored and sometimes not. The script is written in PowerShell.

I opened an issue with Azure CLI and they informed me that this is due to how Knack handles warnings in output.

The default is that a warning is colorized. But if the command output is piped or assigned to a variable, it is not and a 'warning:' prefix is added to the message.

Is it possible for me as a script author to make Azure CLI/Knack always display colorized warnings?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no Knack file, test, or entry point. Start by locating the warning-output handling and checking how terminal, piped, and assigned output are distinguished. Done means determining whether callers can force colorized warnings and documenting or implementing a supported control.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, python
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.