settings

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 17 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 settings is what every command shares: the paths and configuration a command line gives, the engine it opens with them, the places it works in, its --json mark, and the person's editor. The verbs take a *Settings; it imports no verb (part 4, item 2).

Index

Constants

View Source
const HeapProfileVariable = "DOCKHAND_HEAPPROFILE"

HeapProfileVariable names the file a command writes its in-use heap profile to as it exits, and serve also each time its queue empties after work, for a measurement such as what serve holds between daily looks (the roadmap's "serve gives back a look's memory once its work ends").

View Source
const JsonAnnotation = "dockhand.json"

JsonAnnotation marks a command that can report its result as JSON.

View Source
const PullRequestsVariable = compose.PullRequestsVariable

PullRequestsVariable names the sandbox pull requests go to instead of MacPorts' repository (engine.Options.PullRequests).

Variables

This section is empty.

Functions

func EditText

func EditText(ctx context.Context, editor, text string) (string, error)

EditText opens text in $VISUAL or $EDITOR and returns what was saved.

func EditorCommand

func EditorCommand(s *Settings) string

EditorCommand is the person's editor, $VISUAL or else $EDITOR, as a shell command; empty where neither is set.

func KeepHTTPFlag added in v0.7.0

func KeepHTTPFlag(cmd *cobra.Command, s *Settings)

KeepHTTPFlag registers --keep-http on a command whose edits switch a Portfile's plain-HTTP links that answer over HTTPS.

func KeepModelineFlag added in v0.6.0

func KeepModelineFlag(cmd *cobra.Command, s *Settings)

KeepModelineFlag registers --keep-modeline on a command whose edits write a Portfile.

func OverAllowanceFlag

func OverAllowanceFlag(cmd *cobra.Command, s *Settings)

OverAllowanceFlag registers --over-allowance on a command that looks up ports' newest releases.

func RunEditor

func RunEditor(ctx context.Context, editor, path string) error

RunEditor opens path in editor on the terminal dockhand runs on, and waits for it.

func SourceFlag added in v0.8.0

func SourceFlag(cmd *cobra.Command, s *Settings)

SourceFlag registers --source on a command that updates a port's version.

func SupportsJSON

func SupportsJSON(cmd *cobra.Command)

SupportsJSON marks cmd as able to report its result with --json.

func WriteHeapProfile added in v0.8.0

func WriteHeapProfile(file string) error

WriteHeapProfile writes the in-use heap, after a collection, to file, as runtime/pprof makes one, replacing what it held; go tool pprof -sample_index=inuse_space reads it.

Types

type Invocation

type Invocation struct {
	Args, Env []string
	Dir       string
}

Invocation is a command line: its arguments, and the environment and working directory it reads, as os.Environ and os.Getwd give them, in place of the process's.

type Settings

type Settings struct {
	Tree     string
	Database string
	// ToolFlags are --tool's values as given, name=path, and Tools them
	// parsed, by name, a later one for a name winning (ParseTools).
	ToolFlags []string
	Tools     map[string]string
	// File is the configuration file, as read when the engine opened.
	File config.File
	// Opened is the engine a command opened, and openedWith what it opened
	// with, for the cleanup that follows the command's work.
	Opened     *engine.Engine
	OpenedWith engine.Options
	// Streams are the command's, for a question opening the engine asks.
	Streams term.Streams
	// NamesBranch is a command naming a branch, by -b, -p, or --pr or by
	// its name, which run outside any checkout finds the registered one.
	NamesBranch bool
	// Unattended is serve's: nobody answers git's ssh there, at a terminal
	// or not (compose.Options.Unattended), as nobody does without one.
	Unattended bool
	// OverAllowance is --over-allowance: a look goes on past what's left
	// of the hour's GitHub allowance (allowLook).
	OverAllowance bool
	// KeepModeline is --keep-modeline: the Portfiles the command's edits
	// write keep their first line (engine.Engine.KeepModeline).
	KeepModeline bool
	// KeepHTTP is --keep-http: the command's edits leave plain-HTTP links
	// as they are, asking nothing, as [update] keep_http does
	// (engine.Options.KeepHTTP).
	KeepHTTP bool
	// Source is --source: what a version update does about a GitHub
	// port's source, over [update] source (engine.Options.Source).
	Source string
	// Command runs a command line in this one's invocation, its
	// environment, directory, and tree, database, and Git, for one
	// dockhand console runs.
	Command func(context.Context, []string, term.Streams) error
	// Deps are the stand-ins for what compose makes, which a test gives;
	// the real ones where they're empty.
	Deps compose.Dependencies
	// Host is the Mac's, or a test's stand-in.
	Host *host.Host
	// Args are the command line's arguments, as given, the program's name
	// aside: serve compares its agent's with them.
	Args []string
	// Env and dir are the command line's environment and working
	// directory (invocation), which compose reads.
	Env []string
	Dir string
}

Settings are the global selections. Each comes from its flag, then its environment variable, then its default.

func (*Settings) ComposeOptions

func (s *Settings) ComposeOptions() compose.Options

ComposeOptions are the command line's selections, as compose takes them.

func (*Settings) Dependencies

func (s *Settings) Dependencies() compose.Dependencies

Dependencies are the stand-ins for compose: those given, with the login's parts the command shares with setup github, and programs as the host finds them.

func (*Settings) Drain

func (s *Settings) Drain() (int, error)

Drain starts a background drain of the queue, outliving the command, with the options the command was opened with; its pid.

func (*Settings) Flags

func (s *Settings) Flags(root *cobra.Command)

func (*Settings) Getenv

func (s *Settings) Getenv(name string) string

Getenv is the variable's value in the command line's environment.

func (*Settings) Open

func (s *Settings) Open(ctx context.Context) (*engine.Engine, error)

Open opens the engine through compose, asking the person, on a terminal, to migrate a database a process on the older schema is working with.

func (*Settings) Options

func (s *Settings) Options(ctx context.Context) (engine.Options, config.File, string, error)

Options resolves the engine's options, reading the configuration file (compose.Settings).

func (*Settings) ParseTools added in v0.8.0

func (s *Settings) ParseTools() error

ParseTools reads --tool's values into Tools, refusing a value that isn't name=path or names a program dockhand doesn't run.

func (*Settings) Places

func (s *Settings) Places() config.Places

Places are the command line's home and working directory.

func (*Settings) Signin

func (s *Settings) Signin() github.Signin

Signin is how the command line reaches the person's GitHub login, with the host's keeping of it (compose.Options.Signin).

Jump to

Keyboard shortcuts

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