util

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Black

func Black() *colorPrinter

func Blue

func Blue() *colorPrinter

func ColorizeJSON added in v1.1.4

func ColorizeJSON(content []byte) []byte

ColorizeJSON adds ANSI colors to already-encoded JSON tokens.

func Cyan

func Cyan() *colorPrinter

func GetConfigFileDir

func GetConfigFileDir() (string, error)

func Green

func Green() *colorPrinter

func IsJsonArray

func IsJsonArray(value string) bool

func IsRepeatedField

func IsRepeatedField(f string) bool

func Magenta

func Magenta() *colorPrinter

func OpenBrowser added in v1.0.39

func OpenBrowser(url string) error

OpenBrowser 打开浏览器

func ParseToJsonArrayOrObject

func ParseToJsonArrayOrObject(s string) (interface{}, bool)

ParseToJsonArrayOrObject try to parse string to json array or json object

func Print

func Print(a ...interface{}) *colorPrinter

func Printf

func Printf(format string, a ...interface{}) *colorPrinter

func Println

func Println(a ...interface{}) *colorPrinter

func Red

func Red() *colorPrinter

func ShowJson added in v1.0.1

func ShowJson(data interface{}, color bool)

ShowJson prints data as JSON to stdout. Errors are ignored for backward compatibility with existing configure output.

func UnixTimestampToTime added in v1.0.39

func UnixTimestampToTime(ts int64) time.Time

func White

func White() *colorPrinter

func WriteJson added in v1.1.4

func WriteJson(w io.Writer, data interface{}, color bool) error

WriteJson writes indented JSON and optionally adds ANSI token colors.

func Yellow

func Yellow() *colorPrinter

Types

This section is empty.

Directories

Path Synopsis
Package output formats API responses for the CLI.
Package output formats API responses for the CLI.

Jump to

Keyboard shortcuts

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