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