Documentation
¶
Overview ¶
Package completion provides shell completion scripts and dynamic completion candidates for the ssd CLI.
The shell scripts (bash/zsh/fish) are tiny shims that delegate to `ssd __complete <prev-tokens>` for every TAB press. The hidden __complete command parses the tokens already on the command line and prints newline-separated candidates on stdout; the shell does the final prefix filtering against the partial word at the cursor.
Keeping the scripts thin means there is one source of truth for the command/sub-command layout (this package, in Go) instead of three copies that drift apart per shell.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ServiceCommands = map[string]bool{ "deploy": true, "up": true, "update": true, "down": true, "rm": true, "restart": true, "rollback": true, "status": true, "logs": true, "config": true, "scale": true, }
ServiceCommands take a single optional service positional argument (or none, meaning "all services"). Completion offers the configured service names from ssd.yaml.
var TopLevelCommands = []string{
"init", "migrate", "deploy", "up", "update", "down", "rm", "restart",
"rollback", "status", "logs", "config", "env", "secret",
"prune", "scale", "provision", "skill", "completion",
"version", "help",
}
TopLevelCommands lists every command users can invoke directly via `ssd <command>`. Hidden helpers (e.g. __complete) are intentionally omitted so they do not surface in TAB completion.
Functions ¶
func ActivationHint ¶
ActivationHint returns shell-specific instructions the user needs to follow once for the completion file to be picked up. Returns "" when no action is needed (e.g. fish auto-loads its completions dir).
func Complete ¶
Complete prints completion candidates for the given list of already-typed tokens (NOT including the binary name and NOT including the partial word at the cursor). One candidate per line.
The shell filters the output against the cursor's current prefix, so this function returns ALL plausible candidates at the position it infers from prev. It never returns an error: any I/O failure (e.g. missing ssd.yaml) collapses to "no candidates", which is the only sensible behavior during a TAB press.
func DetectShell ¶
func DetectShell() string
DetectShell returns the user's shell ("bash", "zsh", or "fish") based on $SHELL, or "" if unrecognised. On Windows we always return "" since none of the supported shells are first-class there.
func Install ¶
Install writes the completion script for shell to its conventional per-user path and returns the path it wrote to. Existing files are overwritten (re-installing on upgrade should be a no-op).
func InstallPath ¶
InstallPath returns the absolute path the completion script for shell will be written to by Install. Exported so callers (tests, help text) can show it without writing anything.
func Script ¶
Script returns the completion script for the given shell. Returns an error for unknown shells.
func SupportedShells ¶
func SupportedShells() []string
SupportedShells returns the list of shells Install/Script accept, in a stable order suitable for help text.
Types ¶
This section is empty.