[PATCH] Print full paths in pipeline / non-interactive usage

Robert Ames ramses0 at yahoo.com
Sat Jul 20 09:50:52 CEST 2019


When working with nested password directories / structures, it's a pain to pick out a particular password key/identifier for copy/paste.  This patch (and test) is the beginning of teaching pass about interactive v. non-interactive usage so that `pass ls` will print fully qualified identifiers when in non-interactive mode.
The gist of it is captured below, and similar behavior can be seen in the `lastpass-cli` tool (not that lastpass is a great example of what to do in general, but it's very handy to have access to the fully qualified password identifiers).

https://github.com/lastpass/lastpass-cli/blob/master/cmd-ls.c#L287-L288
$ ./src/password-store.sh ls
Password Store
├── xxxxxxxx
│   └── xxxxx.xxx
└── xxxxx
    ├── xxxxxxxxxxxxx.xxx
    ├── xxxxxxx.xxx
    ├── xxxxxxx.xxx
    ├── xxxxxxxxx.xxx
    ├── xxxxxxxxxxxxxxxxxxx.xxx
    ├── xxxxxxxx.xxx
    ├── xx.xx-xxxxxxxx
    ├── xx.xxxxx.xxx
    │   └── xxx-xxx
    ├── xxxxxxx.xxx
    ├── xxxxxxxx
    │   ├── xxxxxx-xxxxx
    │   ├── xxxxx-xxxxx-xxxxxxxx
    │   └── xxxxx-xxxxx-xxxxxxx
    └── xxxxxx.xxx

$ ./src/password-store.sh ls | cat
xxxxxxxx/xxxxx.xxx
xxxxx/xxxxxxx.xxx
xxxxx/xx.xxxxx.xxx/xxx-xxx
xxxxx/xxxxxxx.xxx
xxxxx/xxxxxxx.xxx
xxxxx/xxxxxxxx.xxx
xxxxx/xx.xx-xxxxxxxx
xxxxx/xxxxxxxxxxxxx.xxx
xxxxx/xxxxxxxxx.xxx
xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxxx
xxxxx/xxxxxxxx/xxxxxx-xxxxx
xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxx
xxxxx/xxxxxx.xxx
xxxxx/xxxxxxxxxxxxxxxxxxx.xxx

$ ./src/password-store.sh ls | while read id ; do echo "--==[[ $id ]]==--" ; echo ./src/password-store.sh show $id ; done
--==[[ xxxxxxxx/xxxxx.xxx ]]==--
./src/password-store.sh show xxxxxxxx/xxxxx.xxx
--==[[ xxxxx/xxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxx.xxx
--==[[ xxxxx/xx.xxxxx.xxx/xxx-xxx ]]==--
./src/password-store.sh show xxxxx/xx.xxxxx.xxx/xxx-xxx
--==[[ xxxxx/xxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxx.xxx
--==[[ xxxxx/xxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxx.xxx
--==[[ xxxxx/xxxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxx.xxx
--==[[ xxxxx/xx.xx-xxxxxxxx ]]==--
./src/password-store.sh show xxxxx/xx.xx-xxxxxxxx
--==[[ xxxxx/xxxxxxxxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxxxxxxx.xxx
--==[[ xxxxx/xxxxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxxx.xxx
--==[[ xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxxx
--==[[ xxxxx/xxxxxxxx/xxxxxx-xxxxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxx/xxxxxx-xxxxx
--==[[ xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxx/xxxxx-xxxxx-xxxxxxx
--==[[ xxxxx/xxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxx.xxx
--==[[ xxxxx/xxxxxxxxxxxxxxxxxxx.xxx ]]==--
./src/password-store.sh show xxxxx/xxxxxxxxxxxxxxxxxxx.xxx




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190720/b02a5d77/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Print-full-paths-in-pipeline-non-interactive-usage.patch
Type: text/x-patch
Size: 2836 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190720/b02a5d77/attachment.bin>


More information about the Password-Store mailing list