mirror of
https://github.com/Threnklyn/zeit.git
synced 2026-05-18 21:03:30 +02:00
Implemented #6, added --no-colors flag for disabling coloured output
This commit is contained in:
@@ -3,6 +3,7 @@ package z
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/gookit/color"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -20,6 +21,8 @@ var until string
|
||||
var format string
|
||||
var force bool
|
||||
|
||||
var noColors bool
|
||||
|
||||
const(
|
||||
CharTrack = " ▶"
|
||||
CharFinish = " ■"
|
||||
@@ -44,7 +47,12 @@ func Execute() {
|
||||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig)
|
||||
|
||||
rootCmd.PersistentFlags().BoolVar(&noColors, "no-colors", false, "Do not use colors in output")
|
||||
}
|
||||
|
||||
func initConfig() {
|
||||
if noColors == true {
|
||||
color.Disable()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user