stackabletech / stackabletech/stackablectl
feat: Implement colored output (with `NO_COLOR` support)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 10
- Forks
- 5
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 4
Description
Colours sould only be enabled when the terminal supports them.
For example, when redirecting output or piping to cat, there should be no escape sequences.
I believe there needs to be a condition around the pretty method (or maybe it should be handled by tracing_subscriber::fmt):
Examples:
stackablectl --log-level=DEBUG stack list > /tmp/stackablectl.stdout # plain redirect
stackablectl --log-level=DEBUG stack list | cat > /tmp/stackablectl.stdout # pipe through cat
TERM= stackablectl --log-level=DEBUG stack list > /tmp/stackablectl.stdout # explicitly set TERM to nothing
If I open it in VIM, it looks like this:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rust/stackablectl/src/main.rs around the linked pretty method, and compare whether tracing_subscriber::fmt should handle terminal detection. Run the listed stackablectl commands with redirected and piped output, including an empty TERM, and confirm that non-interactive output has no escape sequences while supported terminal output remains colored and NO_COLOR is respected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100