Documentation
¶
Overview ¶
Package extension runs a Go extension from one value, as SDK in contract.md defines: started as ncly-<domain>, or compiled into ncly and started by it under that name. Either way it parses the call with its manifest, runs the handler of the command, and prints the answer by the kind of the command's result.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Call ¶
type Call struct {
// Path is the command path, such as "hello run".
Path string
// Args holds the positional arguments.
Args []string
// Flags holds each flag that the caller set, by long name. A switch
// holds "true" or "false".
Flags map[string]string
JSON bool
Mode contract.Mode
Printer *i18n.Printer
Stdin io.Reader
// Stdout takes human text only: the SDK prints the answer. Under --json,
// it discards what a command other than a text command writes.
Stdout io.Writer
Stderr io.Writer
}
Call is one validated call of a command.
type Extension ¶
type Extension struct {
// Manifest holds manifest.toml.
Manifest []byte
// Locales holds locales/<lang>.toml.
Locales fs.FS
// Handlers holds one handler per command that runs, keyed by path,
// such as "hello run".
Handlers map[string]Handler
}
Extension is a Go extension: its manifest, its catalogs, and one handler per command that runs.
Click to show internal directories.
Click to hide internal directories.