color

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlag

func AddFlag(cmd *cobra.Command)

AddFlag adds the interactive flag to the given set of command line flags.

func UseColor

func UseColor(osInfo OsInfo) bool

UseColor decides if the color should be enabled based on OsInfo.

Types

type OsInfo

type OsInfo interface {
	GetOs() string
	GetStdoutStat() (os.FileInfo, error)
}

OsInfo defines an interface for obtaining OS-specific information.

type RealOsInfo

type RealOsInfo struct{}

RealOsInfo implements the OsInfo interface using real OS calls.

func (RealOsInfo) GetOs

func (r RealOsInfo) GetOs() string

GetOs returns the operating system's name.

func (RealOsInfo) GetStdoutStat

func (r RealOsInfo) GetStdoutStat() (os.FileInfo, error)

GetStdoutStat returns the FileInfo describing the standard output file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL