[pass] [PATCH] Beef up bash completion

Brian Mattern rephorm at rephorm.com
Sat Sep 22 18:04:44 CEST 2012


On Sat, 22 Sep 2012, Jeffrey Ratcliffe wrote:

> On 22 September 2012 13:17, Jason A. Donenfeld <Jason at zx2c4.com> wrote:
> > I wonder though if this is the wrong approach. Isn't this partially
> > the purpose of the filename completion mode? That it has these
> > semantics built in? Or has this been dealt too finniky to deal with,
> > and so rolling our own is better?
> 
> Brian wanted this:
>  Note: I turned off "-o filenames" because it was incompatible with the
>  auto-expansion. So, I instead quote using `printf "%q"` to handle files
>  with spaces and other odd characters.
> 
> I'm not sure what he really means by "incompatible with auto-expansion".

If "-o filenames" is on, then the completion menu (hit tab twice) will
split any COMPREPLY elements that contain slashes. So, "foo/bar" would
become two items (in the menu only, completion still actually worked as
expected).

Anyway, I got around this by only recursively expanding single-entry
directories if they are the only match (which is the useful use case
anyway).

So, -o filenames is back on. printf is no longer used and UTF8 expansion
works correctly.

See http://git.zx2c4.com/password-store/commit/?id=3f1ea67c5647c51001642e93121836f96075f81c and the previous commit.

Let me know if you find any other issues.

Brian





More information about the Password-Store mailing list