stackabletech / stackabletech/stackablectl
feat: Implement colored output (with `NO_COLOR` support)
Nessuno ha ancora preso questa issue.
- Lingua principale
- Rust
- Stelle
- 10
- Fork
- 5
- Merge medio
- 4h 41m
- PR unite (30g)
- 4
Descrizione
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:
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in rust/stackablectl/src/main.rs intorno al metodo pretty indicato e confronta se tracing_subscriber::fmt debba occuparsi del rilevamento del terminale. Esegui i comandi stackablectl elencati con l’output reindirizzato e convogliato tramite pipe, incluso con un TERM vuoto, e conferma che l’output non interattivo non contenga sequenze di escape, mentre l’output dei terminali supportati rimanga colorato e NO_COLOR venga rispettato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- cli
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 50/100