cmd

package
v14.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "v0.0.0"
	Commit    = "00000000"
	BuildTime = "00000000.000000"
)

Functions

func CancelOnInterrupt

func CancelOnInterrupt(ctx context.Context, f context.CancelFunc)

CancelOnInterrupt calls f when os.Interrupt or SIGTERM is received. It ignores subsequent interrupts on purpose - program should exit correctly after the first signal.

func Run

func Run(factory RunnableFactory)

func RunStages

func RunStages(ctx context.Context, stages ...StageFunc) error

RunStages is a helper that ensures Run() is always executed and there is no chance of early exit so that goroutines from stages don't leak.

Types

type Runnable

type Runnable interface {
	Run(context.Context) error
}

type RunnableFactory

type RunnableFactory func(flagset *pflag.FlagSet, programName string, arguments []string) (Runnable, error)

type StageFunc

type StageFunc func(stager.Stage)

StageFunc is a function that uses the provided Stage to start goroutines.

Directories

Path Synopsis
cli
kas

Jump to

Keyboard shortcuts

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