cli

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package cli implements the k6 docs terminal UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(rt *Runtime) *cobra.Command

NewCommand builds the docs subcommand tree. It captures rt and dispatches to inner functions with specific values.

Types

type FS

type FS interface {
	Stat(name string) (fs.FileInfo, error)
	MkdirAll(path string, perm fs.FileMode) error
	RemoveAll(path string) error
	WriteFile(name string, data []byte, perm fs.FileMode) error
}

FS abstracts the filesystem operations the CLI needs.

type Runtime

type Runtime struct {
	Env    map[string]string
	Stdout io.Writer
	Stderr io.Writer
	IsTTY  bool
	OutFd  int // file descriptor for terminal width detection
	// NoColor and AutoExtRes are functions because k6 parses CLI flags
	// after the command tree is built — the values aren't available yet.
	NoColor    func() bool
	AutoExtRes func() bool
	BinaryPath string
	Ctx        context.Context
	Logf       func(string, ...any)
	FS         FS
}

Runtime holds the environment needed by the docs CLI. It is constructed once by the k6 adapter and passed to NewCommand.

Jump to

Keyboard shortcuts

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