Summary
completions emits nested group names as the joined :command-path (e.g. k8s pods, mcp nrepl) instead of the single next path segment (pods, nrepl). Those tokens are written unquoted into a zsh case arm, which is a parse error, so the generated script does not load.
Reproduced with ladder-cli 0.4.0 (ldr completions).
Cause
In extract-command, leaf commands use command-name, but groups without :fn set :name from the full path:
{:name (->> command-map
:command-path
(string/join " "))
...}
group.tpl then interpolates that into both _values candidates and case $line[1]. $line[1] is only the next word (e.g. pods after ldr k8s), not k8s pods.
There is already a ;; TODO: Support messy group/command combos in that function. The existing subgroup-completion test only nests one extra segment whose path is a single word (subgroup), so it does not catch this.
Generated (broken)
_ldr_k8s() {
...
_values "ldr k8s subcommands" \
"auth[Obtain credentials for an environment]" \
"demo-image[Runs an image in a throw-away node]" \
"k8s pods[Managed Kubernetes pods]"
...
case $line[1] in
auth) _ldr_k8s_auth ;;
demo-image) _ldr_k8s_demo_image ;;
k8s pods) _ldr_k8s_pods ;;
esac
}
Same pattern for mcp nrepl.
Expected
Use the group’s own command name (pods, nrepl) in _values and in case:
"pods[Managed Kubernetes pods]"
...
pods) _ldr_k8s_pods ;;
zsh -n on the generated file should succeed, and compinit should define _ldr_k8s, _ldr_mcp, and the rest of the nested functions.
Also observed (same generator)
#compdef _ldr ldr binds a fake command _ldr. Usual form is #compdef ldr (top-level.tpl).
- When the tool has
:version, -V/--version is added in dispatch via version-option but print-tool only concatenates extra-options and impl/default-tool-options, so version is omitted from completions.
Check
Summary
completionsemits nested group names as the joined:command-path(e.g.k8s pods,mcp nrepl) instead of the single next path segment (pods,nrepl). Those tokens are written unquoted into a zshcasearm, which is a parse error, so the generated script does not load.Reproduced with ladder-cli 0.4.0 (
ldr completions).Cause
In
extract-command, leaf commands usecommand-name, but groups without:fnset:namefrom the full path:{:name (->> command-map :command-path (string/join " ")) ...}group.tplthen interpolates that into both_valuescandidates andcase $line[1].$line[1]is only the next word (e.g.podsafterldr k8s), notk8s pods.There is already a
;; TODO: Support messy group/command combosin that function. The existingsubgroup-completiontest only nests one extra segment whose path is a single word (subgroup), so it does not catch this.Generated (broken)
Same pattern for
mcp nrepl.Expected
Use the group’s own command name (
pods,nrepl) in_valuesand incase:zsh -non the generated file should succeed, andcompinitshould define_ldr_k8s,_ldr_mcp, and the rest of the nested functions.Also observed (same generator)
#compdef _ldr ldrbinds a fake command_ldr. Usual form is#compdef ldr(top-level.tpl).:version,-V/--versionis added indispatchviaversion-optionbutprint-toolonly concatenatesextra-optionsandimpl/default-tool-options, so version is omitted from completions.Check