FS#77231 - [trash-cli] 0.22.10.20-3 breaks file completion in ZSH for `trash-put`

Attached to Project: Community Packages
Opened by Thomas (geigerzaehler) - Sunday, 22 January 2023, 14:44 GMT
Last edited by Alexander Epaneshnikov (alex19EP) - Monday, 20 February 2023, 13:58 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alexander Epaneshnikov (alex19EP)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

I expect ZSH to complete files in the current directory when typing `trash-put <TAB>` in the shell. This stopped working in trash-cli 0.22.10.20-3.

Completion of options works in version 0.22.10.20-3: When I type `trash-put -<TAB>` I presented with a completion menu for all possible options.

The package includes a completion script that is produced by `trash-put --print-completion`. I compared the script included in the package with the output of the command on my machine (using python-shtab 1.5.8-1) and here’s the diff:

--- completions/_trash-put 2023-01-22 15:20:49.925094532 +0100
+++ /usr/share/zsh/site-functions/_trash-put 2022-11-16 13:23:46.000000000 +0100
@@ -11,26 +11,24 @@
}

_shtab_trash_put_options=(
- "(- : *)"{-h,--help}"[show this help message and exit]"
- "(- : *)--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
+ "(- :)"{-h,--help}"[show this help message and exit]"
+ "--print-completion[print shell completion script]:print_completion:(bash zsh tcsh)"
{-d,--directory}"[ignored (for GNU rm compatibility)]"
{-f,--force}"[silently ignore nonexistent files]"
{-i,--interactive}"[prompt before every removal]"
{-r,-R,--recursive}"[ignored (for GNU rm compatibility)]"
"--trash-dir[use TRASHDIR as trash folder]:trashdir:(${$(trash-list --trash-dirs)#parent_*:})"
"*"{-v,--verbose}"[explain what is being done]"
- "(- : *)--version[show program\'s version number and exit]"
- "(*)::files:_trash_files"
+ "(- :)--version[show program\'s version number and exit]"
)


_shtab_trash_put() {
- local context state line curcontext="$curcontext" one_or_more='(-)*' remainder='(*)'
+ local context state line curcontext="$curcontext"

- if ((${_shtab_trash_put_options[(I)${(q)one_or_more}*]} + ${_shtab_trash_put_options[(I)${(q)remainder}*]} == 0)); then # noqa: E501
- _shtab_trash_put_options+=(': :_shtab_trash_put_commands' '*::: :->trash-put')
- fi
- _arguments -C $_shtab_trash_put_options
+ _arguments -C $_shtab_trash_put_options \
+ ': :_shtab_trash_put_commands' \
+ '*::: :->trash-put'

case $state in
trash-put)


The new completion script works for me. It completes files for `trash-put`.
This task depends upon

Closed by  Alexander Epaneshnikov (alex19EP)
Monday, 20 February 2023, 13:58 GMT
Reason for closing:  Fixed
Additional comments about closing:  trash-cli-0.23.2.13.2-1

Loading...