diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-03 16:55:52 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-03 16:55:52 +0800 |
| commit | c31aefaf46c33dea092b357d6311fac7819a3cea (patch) | |
| tree | 90248eac6530ebd06c1df8413816854056823ec1 /mingling_core/tmpls/comps | |
| parent | 3bdd2a8ca23c58673fdd715394e0c804c88dead5 (diff) | |
chore: escape colons in zsh completion descriptions
Fix zsh completion script to escape colons in completion items
and descriptions, preventing parsing issues with `_describe`.
Also iterate over the original completions array for simple
completions to correctly extract completion items.
Diffstat (limited to 'mingling_core/tmpls/comps')
| -rw-r--r-- | mingling_core/tmpls/comps/zsh.zsh | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mingling_core/tmpls/comps/zsh.zsh b/mingling_core/tmpls/comps/zsh.zsh index c1c18bb..f665133 100644 --- a/mingling_core/tmpls/comps/zsh.zsh +++ b/mingling_core/tmpls/comps/zsh.zsh @@ -38,9 +38,9 @@ _<<<bin_name>>>_completion() { local -a parsed_completions for item in "${completions[@]}"; do if [[ "$item" =~ '^([^$]+)\$\((.+)\)$' ]]; then - parsed_completions+=("${match[1]}:${match[2]}") + parsed_completions+=("${match[1]//:/\\:}:${match[2]}") else - parsed_completions+=("$item") + parsed_completions+=("${item//:/\\:}") fi done @@ -48,8 +48,8 @@ _<<<bin_name>>>_completion() { _describe '<<<bin_name>>> commands' parsed_completions else local -a simple_completions - for item in "${parsed_completions[@]}"; do - if [[ "$item" =~ '^([^:]+):(.+)$' ]]; then + for item in "${completions[@]}"; do + if [[ "$item" =~ '^([^$]+)\$\((.+)\)$' ]]; then simple_completions+=("${match[1]}") else simple_completions+=("$item") |
