Files
ohmyzsh/plugins
Marc Cornellà 142a6c7fd5 Fix pass zsh completion and autoloading
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.
2014-08-29 00:39:33 +02:00
..
2014-03-21 11:49:52 -04:00
2014-07-20 13:33:26 +02:00
2014-02-18 14:37:59 -07:00
2013-06-25 22:06:24 +08:00
2013-06-28 15:08:26 +08:00
2014-05-28 11:22:35 +02:00
2013-03-30 16:00:40 +01:00
2014-05-29 10:56:41 +02:00
2011-05-28 13:06:03 -04:00
2012-09-18 22:10:11 +07:00
2014-03-03 10:18:10 -05:00
2014-03-20 10:43:33 +01:00
2014-07-14 16:41:57 -07:00
2013-04-08 09:38:15 +02:00
2013-04-30 02:04:09 -03:00
2013-02-11 11:33:24 +08:00
2014-03-25 16:47:57 +01:00
2012-10-14 22:07:38 +08:00
2013-06-06 12:39:14 +08:00
2013-12-03 08:56:18 -05:00
2014-06-04 12:36:34 +02:00
2014-02-19 15:08:47 +03:00
2014-03-25 16:47:58 +01:00
2011-06-01 20:34:39 -04:00
2012-06-22 15:33:27 +03:00
2011-12-02 12:54:04 +01:00
2014-03-18 10:52:25 +01:00
2014-01-17 12:59:14 +03:00
2012-12-18 08:47:04 +00:00
2014-07-07 15:12:47 +02:00
2012-09-06 19:59:18 +10:00
2014-01-24 10:27:41 -08:00
2014-05-27 10:34:03 -06:00
2011-03-14 01:43:33 -04:00
2013-02-05 09:45:00 +01:00
2013-01-30 05:16:26 -08:00
2013-11-19 09:12:05 +01:00
2014-02-20 10:18:53 -08:00
2013-10-31 13:38:12 +01:00
2013-01-08 13:34:33 +08:00
2014-06-08 10:41:51 +02:00
2014-07-31 21:30:15 +01:00
2013-02-15 16:05:15 +01:00
2013-02-15 16:05:15 +01:00
2013-10-14 07:39:59 -04:00
2014-05-24 08:31:59 +02:00
2013-12-21 19:49:44 +01:00
2013-07-03 11:57:31 +08:00
2014-07-15 15:13:13 +02:00
2011-05-28 13:12:03 -04:00
2013-10-23 23:17:43 -07:00
2013-01-01 19:51:55 -08:00
2013-07-02 00:22:25 +08:00
2014-07-15 14:20:39 +01:00
2013-08-14 14:04:06 +10:00
2014-02-14 14:55:00 +00:00
2012-06-15 10:07:22 +03:00
2013-11-14 14:36:20 -02:00