stackabletech / stackabletech/stackablectl
feat: Implement colored output (with `NO_COLOR` support)
未关闭
还没有人认领这个 Issue。
- 主要语言
- Rust
- 星标
- 10
- 派生
- 5
- 平均合并
- 4 小时 41 分钟
- 30 天内合并 PR
- 4
描述
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:
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 rust/stackablectl/src/main.rs 中链接的 pretty 方法附近开始,比较 tracing_subscriber::fmt 是否应负责终端检测。使用重定向和管道输出运行列出的 stackablectl 命令,包括 TERM 为空的情况,并确认非交互式输出不包含转义序列,而受支持终端的输出仍保持彩色,并且遵循 NO_COLOR。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 50/100