show

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 9 Imported by: 3

README

Show data

contains section, panel, padding, helpPanel, table, tree, title, list, multiList

  • banner

  • title

  • table

  • panel

  • section

  • padding

  • list

  • multi list

  • alert(block)

  • markdown

  • json

GoDoc

Please see https://pkg.go.dev/github.com/gookit/gcli/v3/show

Install

go get github.com/gookit/gcli/v3/show

Develop

Testing:

go test -v -run ^TestTable_MultiLineContent$ ./show/table/...

Documentation

Overview

Package show provides some formatter tools for display data.

Index

Constants

View Source
const (
	// OK success exit code
	OK = 0
	// ERR error exit code
	ERR = 2
)

Variables

This section is empty.

Functions

func AList

func AList(title string, data any, fns ...ListOpFunc)

AList create a List instance and print. options see: Options

Usage:

show.AList("some info", map[string]string{"name": "tom"})

func ATitle added in v3.3.0

func ATitle(titleText string, fns ...title.OptionFunc)

ATitle create a Title instance and print. options see: TitleOption

func Banner(content any, fns ...banner.OptionFunc)

Banner create a Banner instance and print. options see: banner.Options

func JSON

func JSON(v any, prefixAndIndent ...string) int

JSON print pretty JSON data

func MList

func MList(listMap any, fns ...ListOpFunc)

MList show multi list data. options see: Options

Usage:

show.MList(data)
show.MList(data, func(opts *Options) {
	opts.LeftIndent = "    "
})

func NewBanner added in v3.3.0

func NewBanner(content any, fns ...banner.OptionFunc) *banner.Banner

NewBanner create a Banner instance. options see: banner.Options

func NewList

func NewList(title string, data any, fns ...ListOpFunc) *lists.List

NewList create a List instance. options see: Options

func NewLists

func NewLists(listMap any, fns ...ListOpFunc) *lists.Lists

NewLists create a Lists instance and print. options see: Options

func TabWriter

func TabWriter(rows []string) *tabwriter.Writer

TabWriter create. more please see: package text/tabwriter/example_test.go

Usage:

w := TabWriter([]string{
	"a\tb\tc\td\t.",
	"123\t12345\t1234567\t123456789\t."
})
w.Flush()

Types

type FormatterFace

type FormatterFace = showcom.Formatter

FormatterFace interface. for compatible

type ListOpFunc added in v3.1.0

type ListOpFunc = lists.OptionFunc

type ListOption

type ListOption = lists.Options

ListOption alias for lists.Options. for compatible

type PrettyJSON added in v3.1.1

type PrettyJSON struct {
	showcom.Base
}

PrettyJSON struct

func NewPrettyJSON added in v3.1.1

func NewPrettyJSON() *PrettyJSON

NewPrettyJSON instance

type ShownFace

type ShownFace = showcom.ShownFace

ShownFace shown interface. for compatible

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer definition

func NewWriter

func NewWriter(output io.Writer) *Writer

NewWriter create a new writer

func (*Writer) Flush

func (w *Writer) Flush() error

Flush data to io.Writer

func (*Writer) Print

func (w *Writer) Print()

Print data to io.Writer

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Write bytes message

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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