fish

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fish renders completion results in fish's native completion feed and generates the fish 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 as fish's native completion feed: one line per candidate in engine order, the value and description separated by a tab (the tab and description are omitted when the candidate has no description). Descriptions are clamped per CONGA_DESCRIPTION_LENGTH (wire.Candidate.TrimmedDescription). Tabs, newlines, and carriage returns inside values and descriptions are normalized to single spaces. Fish has no channel for directives, messages, styles, or tags: they are silently dropped. toComplete is accepted for seam symmetry and ignored: fish pre-filters candidates engine-side.

func Snippet

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

Snippet renders the fish registration script for the given command name and aliases: one completer function (named after the primary command so several CONGA applications can coexist in one fish session) plus one complete registration pair per name and alias. The function name derives from the primary command name via wire.SanitizeIdentifier (registration lines keep the raw name, quoted via wire.QuoteFish). The function collects the tokenized command line with commandline -opc (words up to the cursor, including the command name, quotes already resolved) and commandline -ct (the word being completed, possibly empty, possibly still carrying quote characters), strips the command name, and feeds the words to the binary's __complete entry point (docs/completion-wire-protocol.md), invoking the binary under the command name the user actually typed — $words[1] (local ./path, PATH lookup, alias, etc.) — so the callback re-invokes the exact binary rather than a generation-time name. Because fish itself tokenizes, no shell-side re-lexing, sed plumbing, or unclosed-quote retry is needed. The 2>/dev/null suppression keeps diagnostics off the terminal: a non-zero exit yields an empty substitution, which fish treats as "no completions".

Types

This section is empty.

Jump to

Keyboard shortcuts

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