FS#76311 - [python-hatch] shell completion is incorrect

Attached to Project: Community Packages
Opened by Wu Zhenyu (Freed) - Thursday, 27 October 2022, 11:02 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:04 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Santiago Torres (sangy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

hatch completion script can be generated by:

```sh
❯ _HATCH_COMPLETE=zsh_source hatch
#compdef hatch

_hatch_completion() {
local -a completions
local -a completions_with_descriptions
local -a response
(( ! $+commands[hatch] )) && return 1

response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _HATCH_COMPLETE=zsh_complete hatch)}")

for type key descr in ${response}; do
if [[ "$type" == "plain" ]]; then
if [[ "$descr" == "_" ]]; then
completions+=("$key")
else
completions_with_descriptions+=("$key":"$descr")
fi
elif [[ "$type" == "dir" ]]; then
_path_files -/
elif [[ "$type" == "file" ]]; then
_path_files -f
fi
done

if [ -n "$completions_with_descriptions" ]; then
_describe -V unsorted completions_with_descriptions -U
fi

if [ -n "$completions" ]; then
compadd -U -V unsorted -a completions
fi
}

compdef _hatch_completion hatch;
```

However,
<https://github.com/archlinux/svntogit-community/blob/packages/python-hatch/trunk/hatch_complete.zsh>
is not correct. `complete_zsh` should be `zsh_complete`.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:04 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/python-hatch/issues/1
Comment by Wu Zhenyu (Freed) - Thursday, 27 October 2022, 11:03 GMT
Same for bash. And miss fish completion script.
Comment by Jelle van der Waa (jelly) - Sunday, 03 September 2023, 16:32 GMT
Please provide a patch, I can't get this to work.
Comment by David Runge (dvzrv) - Monday, 04 September 2023, 10:15 GMT Comment by David Runge (dvzrv) - Monday, 04 September 2023, 10:27 GMT
After recreating .zcompdump I get a `hatch (eval):1: command not found: _hatch_completion`
Completion seems to only work after `source /usr/share/zsh/site-functions/_hatch`... -_-

Loading...