completion

package
v0.15.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package completion hosts the `jira completion` command and the dynamic shell-completion emitters. completionEmitters maps every predictor name to the function that emits its candidates, so a declared predictor with no emitter fails the guard test rather than shipping a silently-empty completion. Dynamic candidates use root's command writer and retain the first write failure across Clib's void callback.

Index

Constants

This section is empty.

Variables

View Source
var HandledPredictors = sortedPredictorNames()

HandledPredictors is the sorted set of predictor names completionEmitters implements. Sourced from the map, so the dispatch and this published list can never disagree.

Functions

This section is empty.

Types

type Handler added in v0.15.2

type Handler struct {
	// contains filtered or unexported fields
}

Handler dispatches dynamic completion requests routed through `--@complete=<kind>` (clib's predictor mechanism). It retains the first candidate write failure because Clib's callback does not return an error.

func NewHandler added in v0.15.2

func NewHandler(w io.Writer, globals startup.Globals) *Handler

NewHandler returns a dynamic completion handler that writes candidates to w.

func (*Handler) Complete added in v0.15.2

func (h *Handler) Complete(_, kind string, args []string)

Complete implements Clib's shell-first completion callback. The shell completion script invokes `jira --@complete=foo -- arg1 arg2` for positional args; each emitter writes one candidate per line, optionally `value\tdesc`.

Each predictor name corresponds either to a flag's `clib.FlagExtra{Complete: "predictor=foo"}` or to an entry in a command's `Annotations["clib"]` `dynamic-args='foo,bar'` list. Unknown kinds emit nothing, leaving the shell to fall back to free-form input.

func (*Handler) Err added in v0.15.2

func (h *Handler) Err() error

Err returns the first dynamic-candidate write failure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL