cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package cli defines the tops command

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the tops version reported by tops version and in every --json document. make build and GoReleaser set it with -ldflags -X; go install cannot, so init falls back to the module version it records. Other builds say dev.

Functions

func NewRootCommand

func NewRootCommand(opts *Options) *cobra.Command

NewRootCommand returns the tops root command with all subcommands attached. Global flags are parsed into opts.

func StyleFor

func StyleFor(w io.Writer, opts Options) term.Style

StyleFor returns how output written to w may be decorated: symbols from the locale, colour only on a terminal and only without --no-color or NO_COLOR.

Types

type Options

type Options struct {
	JSON    bool
	NoColor bool
	Env     string

	Getenv  func(string) string
	Getwd   func() (string, error)
	Geteuid func() int
	Node    helper.Host // the matchine tops node reads
}

Options holds the global flags shared by every command, and the process environment, injected so that tests never touch the real one.

Jump to

Keyboard shortcuts

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