cli

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HelpTemplate = `` /* 1108-byte string literal not displayed */

Template for CLI help output

Variables

View Source
var ErrMustRunAsRoot = fmt.Errorf("must run as root")

ErrMustRunAsRoot is returned when a command must be run as root.

Functions

func IsRunningAsRoot

func IsRunningAsRoot() (bool, error)

IsRunningAsRoot returns true if the current user has UID 0.

func NewLogger

func NewLogger(opts *GlobalOptions) *zap.Logger

Types

type Command

type Command interface {
	Run(log *zap.Logger, opts *GlobalOptions) error
	Flaggy() *flaggy.Subcommand
}

type CommandContainer

type CommandContainer interface {
	AddCommand(Command)
	Flaggy() *flaggy.Subcommand
	Run(log *zap.Logger, opts *GlobalOptions) error
	AsCommand() Command
}

func NewCommandContainer

func NewCommandContainer(name, description string) CommandContainer

type GlobalOptions

type GlobalOptions struct {
	DevelopmentMode bool
}

func NewGlobalOptions

func NewGlobalOptions() *GlobalOptions

Jump to

Keyboard shortcuts

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