cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

build-time vars (injected via -ldflags)

Functions

func Root

func Root() *cobra.Command

Root builds the root command tree.

Types

type App

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

App holds global state shared by every command.

func (*App) Client

func (a *App) Client() *bili.Client

Client lazily builds the bili client from resolved config.

type Format

type Format = render.Format

Format is an output encoding. Aliased from the render package so the rest of the CLI compiles without changes.

const (
	FormatAuto     Format = render.Auto
	FormatTable    Format = render.Table
	FormatList     Format = render.List
	FormatMarkdown Format = render.Markdown
	FormatJSON     Format = render.JSON
	FormatJSONL    Format = render.JSONL
	FormatCSV      Format = render.CSV
	FormatTSV      Format = render.TSV
	FormatURL      Format = render.URL
	FormatRaw      Format = render.Raw
)

type Output

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

Output wraps render.Renderer so commands call Emit/Close without changes.

func NewOutput

func NewOutput(w io.Writer, format Format, fields []string, noHeader bool, tmpl string, isTTY, color bool, width int) (*Output, error)

NewOutput builds an Output. isTTY and color control ANSI emission; width is the terminal column count (0 = no limit).

func (*Output) Close

func (o *Output) Close() error

func (*Output) Emit

func (o *Output) Emit(v any) error

func (*Output) Format added in v0.1.1

func (o *Output) Format() Format

Format returns the resolved format (after Auto is collapsed).

func (*Output) Write added in v0.1.1

func (o *Output) Write(b []byte) (int, error)

Write passes raw bytes through to the underlying writer, bypassing formatting.

Jump to

Keyboard shortcuts

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