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
- func EditText(ctx context.Context, editor, text string) (string, error)
- func EditorCommand(s *Settings) string
- func KeepHTTPFlag(cmd *cobra.Command, s *Settings)
- func KeepModelineFlag(cmd *cobra.Command, s *Settings)
- func OverAllowanceFlag(cmd *cobra.Command, s *Settings)
- func RunEditor(ctx context.Context, editor, path string) error
- func SourceFlag(cmd *cobra.Command, s *Settings)
- func SupportsJSON(cmd *cobra.Command)
- func WriteHeapProfile(file string) error
- type Invocation
- type Settings
- func (s *Settings) ComposeOptions() compose.Options
- func (s *Settings) Dependencies() compose.Dependencies
- func (s *Settings) Drain() (int, error)
- func (s *Settings) Flags(root *cobra.Command)
- func (s *Settings) Getenv(name string) string
- func (s *Settings) Open(ctx context.Context) (*engine.Engine, error)
- func (s *Settings) Options(ctx context.Context) (engine.Options, config.File, string, error)
- func (s *Settings) ParseTools() error
- func (s *Settings) Places() config.Places
- func (s *Settings) Signin() github.Signin
Constants ¶
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").
const JsonAnnotation = "dockhand.json"
JsonAnnotation marks a command that can report its result as JSON.
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 EditorCommand ¶
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
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
KeepModelineFlag registers --keep-modeline on a command whose edits write a Portfile.
func OverAllowanceFlag ¶
OverAllowanceFlag registers --over-allowance on a command that looks up ports' newest releases.
func SourceFlag ¶ added in v0.8.0
SourceFlag registers --source on a command that updates a port's version.
func SupportsJSON ¶
SupportsJSON marks cmd as able to report its result with --json.
func WriteHeapProfile ¶ added in v0.8.0
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 ¶
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 ¶
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 ¶
Drain starts a background drain of the queue, outliving the command, with the options the command was opened with; its pid.
func (*Settings) Open ¶
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 ¶
Options resolves the engine's options, reading the configuration file (compose.Settings).
func (*Settings) ParseTools ¶ added in v0.8.0
ParseTools reads --tool's values into Tools, refusing a value that isn't name=path or names a program dockhand doesn't run.