cli

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package cli runs grelot's client verbs: it reads the command line, the client config and the shell it runs in, sends the API calls, and prints what an agent reads, the status line first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, env *Env, args []string) int

Run runs the command args names, after the global flags --self and --provider <name>, and returns the process exit code.

Types

type Env

type Env struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	// Lookup reads an environment variable.
	Lookup   func(name string) (string, bool)
	Hostname func() (string, error)
	Getwd    func() (string, error)
	// Home is the user's home directory, for a ~ in a provider's paths.
	Home func() (string, error)
	// Now is the clock of the hooks' marks, time.Now when nil.
	Now func() time.Time
	// Machine is the machine id, <kind>:<hex>, or "" when unknown.
	Machine     func(context.Context) string
	InContainer func() bool
	Providers   *provider.Set
	// Processes is read for this process's ancestors; nil reads none.
	Processes proctree.Table
	// ConfigDir is the user config dir; grelot's files are under its grelot
	// folder.
	ConfigDir string
	// Version is the Grelot-Version this client sends; Build is the
	// version grelot version prints, which may be a pseudo-version.
	Version string
	Build   string
	PID     int
	// Timeout bounds each API call; zero takes the client's default.
	Timeout time.Duration
}

Env is what a command reads of the process it runs in.

Jump to

Keyboard shortcuts

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