sxcli.dev/completion/bash
import "sxcli.dev/completion/bash"
Package bash registers the completionbash System applet: bash completion for the importing binary. Blank-import to link it, like a log sink:
import _ "sxcli.dev/completion/bash"Installation (documented by --script's output too):
eval "$(mybin completionbash --script)"The generated script is deliberately dumb: it forwards bash's raw completion state and every interpretation — dropping the command word, slicing at the cursor, reassembling the =-tokens bash splits apart, basename dispatch — happens here, in testable Go.
Index#
Constants#
ID is the package's public handle: name it in a composition's Accept to include bash completion in the binary.
const ID = "sxcli.dev/completion/bash"
type Completion#
Completion is the completionbash System applet. It consumes the core's Introspector (by concrete type, cold like any service) and answers two operations: --script emission and completion queries.
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) Configured#
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) Run#
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.