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
Update pass completion and fix syntax and autoloading #2941
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcornella
changed the title
Fix pass completion syntax and autoloading. Fixes #2846
Fix pass completion syntax and autoloading
Jul 20, 2014
mcornella
changed the title
Fix pass completion syntax and autoloading
Update pass completion and fix syntax and autoloading
Jul 20, 2014
I submitted a PR to the mailing list of the password-store project. Expect a response in the following week |
I was able to reproduce the bug #2846 and with @mcornella's PR the issue it's fixed. Thanks for the patch and sorry for the delay to reply. |
Conflicts: plugins/pass/_pass
When autocompleting from `pass <TAB>', sometimes the following errors appear: _values:compvalues:10: not enough arguments find: `/home/user/.password-store': No such file or directory _values:compvalues:10: not enough arguments find: `/home/user/.password-store': No such file or directory The `_values' error happens when there is no password-store folder *or* there are no passwords in pass; the `find' error only when there is no password-store folder. We can trace it back to line 108, which contains the only `_values' statement that is executed when we autocomplete from pass. We confirm this by following the trail of execution, which is _pass -> _pass_cmd_show -> _pass_complete_entries -> -> _pass_complete_entries_helper If we try running the command inside `$()' on line 104, we see that it returns nothing and the output is blank. This means that `_values' only receives 1 of its 2 mandatory parameters, therefore the above error is triggered (not enough arguments). That is unless we don't have a password-store folder, in which case the `find: [...] no such file or directory' error is *also* triggered. We solve the first error by supplying a default value of "" if the command outputs nothing, using the zsh construct ${var:-else}. We solve the second error by redirecting the find command's stderr output to /dev/null, so the error is effectively suppressed. * * * * This patch also fixes the first tab completion, which currently only loads the completion function definition. We do this by adding a `_pass' statement at the end of the file, which runs the `_pass' completion function after loading its definition. This is the standard way an autoloaded function works; for other examples look at zsh's official completion files.
mcornella
force-pushed
the
fix-pass-completion
branch
from
August 28, 2014 22:41
4bf87c2
to
142a6c7
Compare
robbyrussell
added a commit
that referenced
this pull request
Aug 31, 2014
Update pass completion and fix syntax and autoloading
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
STATUS: TESTED, WAITING FOR INPUT.
Fixes #2846, closes #1480.
/cc @sanbor @christianschmidt
This pull request fixes the copyright notice (by @sanbor) and updates the zsh pass completion to the current one on the upstream project.
It also fixes the errors that appear in #2846 and the first TAB completion.
Refer to mcornella@4bf87c2 for more information.