pass list

Robert Ames ramses0 at yahoo.com
Wed Apr 14 21:56:27 UTC 2021


Detect TTY (interactive status):
+[[ -t 1 ]] && YES_TTY=1

If NO_TTY, use find + sed as suggested, else keep the existing "Tree" command:
-        tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors
+        if [[ -z $YES_TTY ]] ; then
+            find "$PREFIX/$path" -type f -iname \*.gpg | sed -e 's/\.gpg$//g' -e "s,^$PREFIX,,g" -e 's/^\///g' # when non-interactive (pipeline) print full-path-per-entry (for easy copy/paste or filtering)
+        else
+            tree -C -l --noreport "$PREFIX/$path" | tail -n +2 | sed -E 's/\.gpg(\x1B\[[0-9]+m)?( ->|$)/\1\2/g' # remove .gpg at end of line, but keep colors
+        fi

... at Dacoda... yep, "naive find" was what I came up with in 2019.

Other password managers change behaviour slightly when running in a TTY/NO_TTY context:
https://github.com/lastpass/lastpass-cli/blob/2a70884ed7ef48a8d621687acb96202cc354245b/cmd-ls.c#L287-L288

It's _crucial_ to support `pass ls | grep ...` and be able to show the full identifier for usage.

--Robert



On Wednesday, April 14, 2021, 08:20:36 AM PDT, Dacoda Strack <dacoda.strack at gmail.com> wrote: 





On Wed, Apr 14, 2021 at 04:01:50PM +0300, Greg Minshall wrote:

> Pierre,
> 
> > I am willing to write a patch if we find consensus.
> 
> i'd be a fan.  and, if highlighting could somehow also be controlled,
> that would be great.
> 
> cheers, Greg


This sounds great to me, I wonder if something naive like 

find $PASSWORD_STORE -type f -name '*.gpg'

with some additional sed to clean up the path would get us where we need
to be

I think I'm going to have a small local fork and build RPMs with some 
of these minor patches.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Print-full-paths-in-pipeline-non-interactive-usage.patch
Type: application/octet-stream
Size: 2836 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20210414/4446590e/attachment.obj>


More information about the Password-Store mailing list