commands: Only show Ansi escape codes if in a terminal

This commit is contained in:
Bjørn Erik Pedersen 2018-10-26 14:32:32 +02:00
parent 78578632f5
commit df021317a9
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
4 changed files with 25 additions and 50 deletions

View file

@ -23,6 +23,13 @@ import (
"github.com/spf13/cobra"
)
const (
ansiEsc = "\u001B"
clearLine = "\r\033[K"
hideCursor = ansiEsc + "[?25l"
showCursor = ansiEsc + "[?25h"
)
type flagsToConfigHandler interface {
flagsToConfig(cfg config.Provider)
}