Using find(1) instead of tree(1)

Alejandro Colomar alx at kernel.org
Sun Sep 24 13:22:25 UTC 2023


Hi,

I would like to be able to filter the results of pass using standard
Unix tools.  The reason is I have a rather large password database (and
it's only going to increase):

	$ pass show | wc -l
	552

I don't have 552 passwords, but I use pass(1) also as a bookmark for
websites.

	$ pass show www/foss/kernel/bugzilla/
	www/foss/kernel/bugzilla
	├── alx
	│   ├── id
	│   └── pass
	└── url

For example, for the kernel bugzilla, you can see that I not only store
the password, but I also store the username (id), and the url.

	$ pass show www/foss/kernel/bugzilla/url 
	https://bugzilla.kernel.org/

	$ pass show www/foss/kernel/bugzilla/alx/id 
	alx at kernel.org


The problem comes when I need to search for something I don't remember:
Let's say I want to see everything I have for "kernel", but don't
remember where kernel is:

	$ pass find kernel
	Search Terms: kernel
	└── www
	    └── foss
		└── kernel

Okay, so I want to search "www/foss/kernel"; but I have to type it!  It
would be preferable to have some '--find' ('-f') that worked like this:
(The name --find would be because it would use find(1) underneath.)

	$ pass find --find kernel
	www/foss/kernel/

(Notice the trailing slash (which find(1) doesn't add).  It's useful to
 know it's a dir.)

Then I would just pass that to my next command:

	$ pass find --find kernel \
	  | xargs pass show --find
	www/foss/kernel/
	www/foss/kernel/smtp/
	www/foss/kernel/smtp/pass
	www/foss/kernel/bugzilla/
	www/foss/kernel/bugzilla/url
	www/foss/kernel/bugzilla/alx/
	www/foss/kernel/bugzilla/alx/id
	www/foss/kernel/bugzilla/alx/pass

And then I can just grep from there what I need (say the bugzilla
password):

	$ pass find --find kernel \
	  | xargs pass show --find \
	  | grep 'bugzilla.*/pass'
	www/foss/kernel/bugzilla/alx/pass

And finally show the pass:

	$ pass find --find kernel \
	  | xargs pass show --find \
	  | grep 'bugzilla.*/pass' \
	  | xargs pass show
	pw


Would you want this feature?  If you agree, I'll start writing it, and
will ask if I have any doubts.

Thanks,
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20230924/10a5e51b/attachment.sig>


More information about the Password-Store mailing list