cliconfig

package
v1.13.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: 0BSD Imports: 6 Imported by: 0

Documentation

Overview

Package cliconfig manages the client-side configuration: named forge instances at ~/.config/forge/config.toml, and parsing of origin remote URLs so commands run inside a clone need no --repo argument.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() string

func Save

func Save(cfg Config) error

Types

type Config

type Config struct {
	Default   string              `toml:"default,omitempty"`
	Instances map[string]Instance `toml:"instances"`
}

func Load

func Load() (Config, error)

func (Config) DefaultInstance

func (c Config) DefaultInstance() (Instance, string, error)

DefaultInstance returns the configured default (or the only) instance.

type Instance

type Instance struct {
	Host string `toml:"host"`
	Port int    `toml:"port,omitempty"`
	User string `toml:"user,omitempty"`
	// SSHOptions are extra arguments passed to the ssh binary verbatim,
	// e.g. ["-i", "~/.ssh/forge_ed25519"]. Most setups need none: the
	// system ssh already honors ~/.ssh/config and the agent.
	SSHOptions []string `toml:"ssh_options,omitempty"`
	// NoMultiplex turns off SSH connection sharing for this instance. On
	// by default: one handshake per five minutes instead of one per
	// command.
	NoMultiplex bool `toml:"no_multiplex,omitempty"`
}

func ParseRemoteURL

func ParseRemoteURL(url string) (Instance, string, bool)

ParseRemoteURL extracts the instance coordinates and owner/name from a git remote URL in ssh:// or scp-like form.

func (Instance) CloneURL

func (i Instance) CloneURL(repo string) string

CloneURL returns the ssh:// URL for owner/name on this instance.

func (Instance) SSHUser

func (i Instance) SSHUser() string

Source Files

  • cliconfig.go

Jump to

Keyboard shortcuts

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