sxcli.devSimple Extensible CLI
You are viewing an archived snapshot (v0.1.0). Switch to the current version →

sxcli.dev/completion/script

go
go
import "sxcli.dev/completion/script"

Package script holds the generation policy shared by the shell adapters — the parts of --script emission that are about the framework's dispatch semantics, not about any shell. The engine stays ignorant of script generation; the adapters (third-party ones included) own their templates and encodings and come here for the decisions, so dispatch truth is never reimplemented per shell.

Index#

func BakedApplet#

go
go
func BakedApplet(src engine.Source, name string) string

BakedApplet decides the --applet value a generated script bakes in for the command name it serves — generation THROUGH a name decides for that name, once:

  • single-applet mode: nothing baked ("*"); any name runs the sole applet and the engine resolves it per query.
  • the name is a public applet (a symlink in the busybox farm): the name itself; dispatch rule 4 would run exactly it.
  • anything else — the real binary's own name included: nothing baked; selector logic stays live, matching dispatch rules 3–4.

func Sanitize#

go
go
func Sanitize(name string) string

Sanitize turns an arbitrary command name into a shell function name suffix: anything outside [A-Za-z0-9] becomes an underscore.