cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 21 Imported by: ? 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 cli is the la command tree as a library. The la binary runs it as its root; a host such as Outcome mounts it under its own name (`out la`) by calling Main with a Config that says how to re-invoke itself.

Index

Constants

View Source
const ContainerName = "laforge"

ContainerName is the one forge container per machine.

View Source
const DefaultPort = 4646

DefaultPort is where the forge listens when it is free.

View Source
const LocalImage = "laforge:local"

LocalImage is what `make image` builds.

View Source
const PublishedImage = "ghcr.io/runoutcome/laforge"

PublishedImage is where release images are published.

Variables

View Source
var Version = "dev"

Version is set at build time (-ldflags "-X .../cli.Version=v0.1.0").

Functions

func DefaultImage

func DefaultImage() string

DefaultImage is the image `la up --container` runs ($LAFORGE_IMAGE to change): a release build runs the image of its own version, a development build the locally built one.

func Home

func Home() string

Home is the forge's folder: $LAFORGE_HOME, else ~/.laforge/forge.

func Main

func Main(cfg Config, args []string) int

Main runs one command and returns the exit code.

Types

type Config

type Config struct {
	// Prog is the name shown in usage and messages: "la" or "out la".
	Prog string
	// Reexec is the argument prefix that reaches this tree when the current
	// executable is run again: nil for la, []string{"la"} for out.
	Reexec []string
	// Stdout and Stderr default to the process's own.
	Stdout, Stderr io.Writer
}

Config says who is running the command tree.

type ContainerState

type ContainerState struct {
	Image     string    `json:"image"`
	Port      int       `json:"port"`
	Token     string    `json:"token"`
	Workspace string    `json:"workspace"`
	Runtime   string    `json:"runtime"`
	StartedAt time.Time `json:"startedAt"`
}

ContainerState is what the host keeps about the forge container in <home>/container.json: enough to give a link without asking the container.

type State

type State struct {
	PID       int       `json:"pid"`
	Port      int       `json:"port"`
	URL       string    `json:"url"`
	Token     string    `json:"token"`
	Version   string    `json:"version"`
	Home      string    `json:"home"`
	StartedAt time.Time `json:"startedAt"`
}

State is what a running forge writes to <home>/forge.json.

Jump to

Keyboard shortcuts

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