launch

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package launch is what features do around the app as the command line opens it: flags of the launch they add, and their work before the app runs and once it ends, such as a git worktree the launch's sessions work in

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Folder

func Folder(ctx context.Context) string

Folder the launch works in: the one WithFolder set, otherwise the process's working folder. Empty when neither can be read

func WithFolder

func WithFolder(ctx context.Context, dir string) context.Context

Context of a launch that works in the folder, such as a worktree, without changing the process's working folder

func WithGiven

func WithGiven(ctx context.Context, given Given) context.Context

Context carrying the flags of the launch taken ahead of a command, such as icebath -w chat, which the command runs the work around it with

Types

type Flag

type Flag struct {
	// Spellings, such as -w and --worktree
	Names []string
	Help  string
	// What the value it takes names, such as "names", for a flag given as -s NAME or --skills=NAME, as often as wanted. Empty for a flag
	// that takes none
	Value string
}

A flag of the launch

type Given

type Given map[string][]string

Given maps each given launch flag, by its first spelling, to its values in the order they were given.

func From

func From(ctx context.Context) Given

Flags of the launch the context carries, by their first spelling. None when it carries none

func (Given) Has

func (g Given) Has(name string) bool

Whether the flag was given

func (Given) Values

func (g Given) Values(name string) []string

Values the flag was given, each comma separated list split and blanks left out. None when it was not given

func (Given) With

func (g Given) With(name string, values ...string) Given

Copy with the flag given, its values after those it holds

type Launch

type Launch struct {
	Registry
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) *Launch

func (*Launch) Cleaning

func (l *Launch) Cleaning(kill func())

Ends the process should its cleanup, which begins now, still run after the exit watchdog. Kill ends the commands it started first

func (*Launch) Signaled

func (l *Launch) Signaled(ctx context.Context, kill func())

Ends the process should it still run twice the exit watchdog after the stop signal ctx ends with, unless its cleanup runs by then; kill ends the commands it started first

type Registrant

type Registrant interface {
	// Flags of the launch the feature takes
	Flags() []Flag
	// Runs the app, doing around it what the flags given, by their first spelling, and the settings ask of the feature
	Around(ctx context.Context, conn *connect.Client, given Given, run Run) error
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func (*Registry) Around

func (r *Registry) Around(ctx context.Context, conn *connect.Client, given Given, run Run) error

Runs the app inside the work of every registrant, the first registered outermost

func (*Registry) Flags

func (r *Registry) Flags() []Flag

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

func (*Registry) Take

func (r *Registry) Take(args []string) ([]string, Given)

Takes the registered flags out of a launch of the app, a command line that starts with a flag or is empty, by their first spelling, a flag that takes a value with the word after it or what follows its = sign. Any other command line as it is, none taken

type Run

type Run func(ctx context.Context) error

Runs the app, the next feature's work around it included

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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