sxcli.devSimple Extensible CLI

sxcli.dev/completion/zsh

go
go
import "sxcli.dev/completion/zsh"

Package zsh registers the completionzsh System applet: zsh completion for the importing binary. Blank-import to link it, like a log sink:

code
text
import _ "sxcli.dev/completion/zsh"

Installation (compinit must have run first — standard zsh setup):

code
text
eval "$(mybin completionzsh --script)"

Zsh tokenizes the command line properly — no COMP_WORDBREAKS shredding, quotes honored — so the transport is simpler than bash's: no line, no breaks, no reassembly. $PREFIX is the part of the current word before the cursor, which is exactly the engine's Current contract. And zsh renders descriptions: the usage/Doc metadata finally shows, rendered through Tr.

Index#

Constants#

ID is the package's public handle: name it in a composition's Accept to include zsh completion in the binary.

go
go
const ID = "sxcli.dev/completion/zsh"

type Completionsrc#

Completion is the completionzsh System applet. It consumes the core's Introspector (by concrete type, cold like any service) and answers two operations: --script emission and completion queries.

go
go
type Completion struct {
    // I is the core's composition truth; the closure containing it is
    // never ejected, and only completion invocations pay that.
    I *fw.Introspector `inject:""`
    // contains filtered or unexported fields
}

func (*Completion) Configuredsrc#

go
go
func (c *Completion) Configured() error

Configured validates nothing: the query fields are per-invocation transport with no illegal states the parser does not already refuse.

func (*Completion) Runsrc#

go
go
func (c *Completion) Run() int

Run answers the operation selected by the arguments: --script emission, or a completion query. Queries always exit 0 — a completion must never look like a failure.