Commit Graph
8 Commits
Author SHA1 Message Date
Adrià Arrufat db234e4e21 completion: check bash path arms against the CLI table
The shell harness kept its own list of path-valued flags, so a new
`.path` flag went untested and a renamed one failed the harness. A unit
test now walks the CLI table and checks each path flag and positional
arm, and the harness keeps one long flag, one short flag and one
positional to exercise the helper.

The interactive test fed keystrokes with fixed sleeps, which a slow CI
runner can outlast. It now waits for the rc file to load and for each
command to run before typing the next one, which also takes it from
~27s to ~1s.
2026-11-04 10:35:26 +01:00
pqminh27 b167bc0af0 fix(completion): preserve path quoting across Bash versions 2026-11-04 09:01:12 +07:00
Adrià Arrufat c37f2f7353 completion: update zsh test for reworded invisible strip-mode help 2026-10-05 13:02:47 +02:00
Adrià Arrufat 404ef3abdb completion: simplify the script emitters
Help text is written through a `Text` formatter whose quoting is a shell
plus the characters a nested context escapes, instead of four hand-merged
escape tables; it also handles `{{`/`}}` and escapes the exec name. The
three value-description loops share `writeValues`, zsh writes `-a` and
`--attach` as one brace-expanded spec, and completion.zig reuses the
builder's `command_names`.
2026-09-26 23:24:48 +02:00
Adrià Arrufat c2ea65a0c3 bash completion: skip list items already chosen
A small helper completes the item after the last comma, like fish's,
so `--load-resources image,<TAB>` no longer offers `image` again.
2026-09-26 23:17:35 +02:00
Adrià Arrufat 9aea776d51 zsh completion: describe values
Enum values use the ((value\:description)) action and packed-struct
values _values' value[description] specs, with descriptions from the
same "Allowed values:" tables fish uses.
2026-09-26 23:14:40 +02:00
Adrià Arrufat 9a00cdc83d fish completion: describe values and complete comma lists
Enum and packed-struct values get their description from the flag's
"Allowed values:" table in help.zon, and values without one get an
empty description so fish doesn't repeat the flag's. A small helper
completes the item after the last comma for --load-resources and the
like, leaving out the items already chosen.
2026-09-26 23:12:11 +02:00
Adrià Arrufat d26e1e2f55 Add shell completion for bash, fish and zsh
`lightpanda completion <bash | fish | zsh>` prints a completion script
for commands, flags and their values. The scripts are generated from
the command recipe, so a new flag is completed without extra work:
enum options offer their tags, packed-struct options their fields,
and options marked `.path = true` offer files. Descriptions are the
first sentence of each flag's help.zon entry.

To support it, the cli builder gains enum positionals and a per-command
flag list that both completion and the "did you mean" suggestions use.
Deprecated flags are no longer suggested.
2026-09-26 23:02:42 +02:00