package cmd

import "cuelang.org/go/cmd/cue/cmd"

Index

Variables

var ErrPrintedError = errors.New("terminating because of errors")

ErrPrintedError indicates error messages have been printed directly to stderr, and can be used so that the returned error itself isn't printed as well.

Functions

func Main

func Main() int

Main runs the cue tool and returns the code for passing to os.Exit.

Types

type Command

type Command struct {
	// The currently active command.
	*cobra.Command
	// contains filtered or unexported fields
}

func New

func New(args []string) (*Command, error)

New creates the top-level command. The returned error is always nil, and is a historical artifact.

func (*Command) Run

func (c *Command) Run(ctx context.Context) (err error)

func (*Command) SetInput

func (c *Command) SetInput(r io.Reader)

func (*Command) SetOutput

func (c *Command) SetOutput(w io.Writer)

func (*Command) Stderr

func (c *Command) Stderr() io.Writer

Stderr returns a writer that should be used for error messages. Writing to it will result in the command's exit code being 1.

TODO(mvdan): provide an alternative to write to stderr without setting the exit code to 1.

type Stats

type Stats struct {
	// CUE groups stats obtained from the CUE evaluator.
	CUE stats.Counts

	// Go groups stats obtained from the Go runtime.
	Go struct {
		AllocBytes   uint64
		AllocObjects uint64
	}
}

Stats expands stats.Counts with counters obtained from other sources, such as the Go runtime. The stats are grouped by category to clarify their source.

Source Files

add.go cmd.go common.go completion.go custom.go def.go eval.go export.go fix.go flags.go fmt.go get.go get_go.go help.go import.go login.go mod.go modedit.go modfix.go modget.go modinit.go modpublish.go modregistry.go modresolve.go modtidy.go orphans.go registry.go root.go trim.go version.go vet.go

Version
v0.10.0-alpha.1
Published
Jul 12, 2024
Platform
windows/amd64
Imports
97 packages
Last checked
47 minutes ago

Tools for package owners.