Implemented #6, added --no-colors
flag for disabling coloured output
This commit is contained in:
parent
6e0ecbb007
commit
822ded9dfc
1 changed files with 8 additions and 0 deletions
|
@ -3,6 +3,7 @@ package z
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/gookit/color"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,6 +21,8 @@ var until string
|
||||||
var format string
|
var format string
|
||||||
var force bool
|
var force bool
|
||||||
|
|
||||||
|
var noColors bool
|
||||||
|
|
||||||
const(
|
const(
|
||||||
CharTrack = " ▶"
|
CharTrack = " ▶"
|
||||||
CharFinish = " ■"
|
CharFinish = " ■"
|
||||||
|
@ -44,7 +47,12 @@ func Execute() {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cobra.OnInitialize(initConfig)
|
cobra.OnInitialize(initConfig)
|
||||||
|
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&noColors, "no-colors", false, "Do not use colors in output")
|
||||||
}
|
}
|
||||||
|
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
|
if noColors == true {
|
||||||
|
color.Disable()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue