Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh completion does not allow directories to be tab-completed #414

Closed
IzhakJakov opened this issue Jul 15, 2024 · 5 comments
Closed

zsh completion does not allow directories to be tab-completed #414

IzhakJakov opened this issue Jul 15, 2024 · 5 comments

Comments

@IzhakJakov
Copy link

I am experiencing the same issue as described in #359:

With the ZSH completion, when I attempt to tab-complete a directory:

$ dust Docu<tab>

it does nothing. The expected behavior is for it to tab-complete the directory name.

The original issue was resolved in #390 so I am not sure if it is me that is doing something wrong but I do not have any other zsh completion ATM.

Moreover, the completion of --<option> works as expected so it is only the paths that are not getting completed.

I am using Macbook with M3 Pro but tested this on a Macbook with Intel i9 and it has the problem.

@IzhakJakov
Copy link
Author

$ dust --version
Dust 1.0.0

@IzhakJakov
Copy link
Author

After a quick investigation it seems like the fix is not in any official release yet thus missing from most pkg managers. I fixed the problem locally now and do not mind creating a PR to patch v1.0.0 if you do not mind creating a branch for v1.0 then after merging the patch you can release as 1.0.1:

$ git checkout tags/v1.0.0 -b v1.0

$ git push --set-upstream origin v1.0

@bootandy
Copy link
Owner

Sadly a re-occurring problem. Whenever anyone rebuilds the completions file it seems to destroy the fix for zsh completion.

Does your fix look like this ?
0038cb2

@IzhakJakov
Copy link
Author

$ git diff completions/_dust
index ecf5150..8745356 100644
--- completions/_dust
+++ completions/_dust
@@ -19,10 +19,10 @@ _dust() {
 '--depth=[Depth to show]: : ' \
 '-n+[Number of lines of output to show. (Default is terminal_height - 10)]: : ' \
 '--number-of-lines=[Number of lines of output to show. (Default is terminal_height - 10)]: : ' \
-'*-X+[Exclude any file or directory with this name]: : ' \
-'*--ignore-directory=[Exclude any file or directory with this name]: : ' \
-'-I+[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]: : ' \
-'--ignore-all-in-file=[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]: : ' \
+'*-X+[Exclude any file or directory with this name]:ignore directory:_files' \
+'*--ignore-directory=[Exclude any file or directory with this name]:ignore directory:_files' \
+'-I+[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]:ignore all in file:_files' \
+'--ignore-all-in-file=[Exclude any file or directory with a regex matching that listed in this file, the file entries will be added to the ignore regexs provided by --invert_filter]:ignore all in file:_files' \
 '-z+[Minimum size file to include in output]: : ' \
 '--min-size=[Minimum size file to include in output]: : ' \
 '(-e --filter -t --file_types)*-v+[Exclude filepaths matching this regex. To ignore png files type\: -v "\\.png\$" ]: : ' \
@@ -72,7 +72,7 @@ _dust() {
 '--help[Print help]' \
 '-V[Print version]' \
 '--version[Print version]' \
-'*::params:' \
+'*: :_files' \
 && ret=0
 }

Basically stole some stuff from #390 and applied them to v1.0

I did it for myself as a tmp solution until your next release but then decided to share so you can have a quick patch for v1.0

Anyways, I noticed you released v1.1.0 a few hours ago so maybe none of this matters anymore. I wait for it update in my system and if there are problems I'll re-open this issue.

Thanks for taking a look!

@IzhakJakov
Copy link
Author

Seems to be working as expected. Tested with v1.1.1. Thank you! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants