Documentation
¶
Overview ¶
Package powershell renders completion results as the JSON payload consumed by the generated registration snippet and generates the Register-ArgumentCompleter snippets for the wire protocol (docs/completion-wire-protocol.md).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format renders candidates and directives in the powershell framing: the export JSON schema plus a per-candidate "sgr" field, with the presentation fields pre-composed for the snippet's CompletionResult mapping. "value" carries the insertion text (quoted when it contains whitespace or metacharacters, with a trailing space unless the nospace rules apply); "display" carries the ListItemText content ("display (description)" normally, the bare display in tooltip mode); "description" carries the ToolTip content (the clamped description in tooltip mode, a single space otherwise). Styled segments are wrapped in backtick-escaped SGR sequences when color is enabled. Candidates with an empty value never reach the framing (wire.FromResult drops them). toComplete is accepted for seam symmetry and ignored: the framing is position-independent.
func Snippet ¶
Snippet renders the PowerShell registration script for the given command name and aliases (docs/completion-wire-protocol.md): the single-command form defines one completer function and registers it for the command name (plus its .exe variant, active on Windows and commented out elsewhere); the multi-command form assigns one completer scriptblock (invoking the binary under the name the user typed, .exe suffix stripped) shared by one registration line per name and alias. The completer collects the cursor-truncated command elements (quotes stripped, PowerShell's tokenization), drops the program name, and feeds the words to the binary's __complete entry point; the JSON payload is piped through ConvertFrom-Json into CompletionResult objects. An empty result set returns "" so PowerShell's default file completion is suppressed.
Types ¶
This section is empty.