elvish

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package elvish renders completion results as a single-line JSON object for elvish's edit:complex-candidate consumption and generates the elvish registration snippet for the wire protocol (docs/completion-wire-protocol.md).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(toComplete string, directives wire.Directives, candidates []wire.Candidate) string

Format renders candidates and directives in the elvish framing: a single-line JSON object (no trailing newline) with candidates in engine order. Every top-level field (usage, messages, descriptionStyle) and every candidate field (value, display, description, codeSuffix, style) is always present. The usage string is cleared when any candidates exist: it is only sent for the zero-candidate error case, where messages carry it. The framing is position-independent: toComplete is accepted for seam symmetry and ignored.

func Snippet

func Snippet(name string, aliases []string, _ string) string

Snippet renders the elvish registration script for the given command name and aliases: one shared completer lambda plus one arg-completer registration per name and alias. The lambda sets CONGA_SHELL for the engine's shell-aware framing decisions, slices off the command name (elvish passes it in front of the arguments; the word being completed is the last argument, possibly an empty string), and invokes the binary's __complete entry point via argv only (docs/completion-wire-protocol.md). The payload's usage and diagnostic messages are omitted to enforce terminal display purity (preventing prompt displacement and scrollback pollution in elvish), and each candidate renders as an edit:complex-candidate with a styled display, a description suffix styled by the payload's descriptionStyle, and the codeSuffix controlling post-insert spacing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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