Documentation
¶
Overview ¶
Package cli assembles everything a command needs to run.
It sits between the cobra front end and the domain layer, and it exists so that no command has to know how a token is found, how a team is resolved, or which renderer the user's terminal deserves. A command receives a ready Context and returns data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
Exec execctx.Context
Config config.Resolved
Out *output.Writer
// Fields is --fields, already split. Empty means every field.
Fields []string
// DryRun is --dry-run.
DryRun bool
// contains filtered or unexported fields
}
Context is the resolved environment for one invocation.
func Build ¶
func Build(exec execctx.Context, ov config.Overrides, version string, out, errw io.Writer) (*Context, error)
Build resolves configuration and prepares the output writer.
It does not require a credential: whether one is needed is a per-command decision, and `schema`, `version` and `help` must work on a machine that has never logged in.
func (*Context) APIClient ¶
APIClient returns a client for the Out Plane API, or an actionable error explaining how to authenticate.
The error is written carefully: an agent that receives it should be able to act without asking a human, and a human should not have to search the docs.
func (*Context) SignInError ¶
SignInError is the credential-resolution failure for this invocation, phrased for a human and for an agent.
Exposed so that commands which read the credential without making a request, `whoami` and `status`, produce the same message as one that does. Two different explanations of the same condition would be worse than either.