[pass] Feature request – combined insert/generate/edit for new entries

Lucas Hoffmann l-m-h at web.de
Sat Jul 16 02:21:14 CEST 2016

Quoting Kenny Evitt (2016-07-15 21:49:26)
> I often want to add an entry but also generate a new random password and
> add additional info ('edit') and, given that I'm tracking the history of
> my entries with Git, it'd be nice (or nicest) to do all of that as a
> single commit. Besides the Git history, it'd also be nice to do all of
> that as a single `pass ...` command too.
> The closest I can come to this is to run `pass edit ...`. In my editor
> (Vim) I can insert the output of running `pwgen` easily enough (by running
> the Vim command `:r !pwgen -s -y 32` or similar), but it'd be nice for
> `pass edit ...` to insert a password for me (if no existing entry matches
> the path I provide) or for another command to do so instead of `edit`.

Does this solve your use case?

pass generate -n somenew 20
pass edit somenew
GIT_SEQUENCE_EDITOR='sed -i "2 s/^pick/f/"' pass git rebase -i HEAD~2
pass show -c somenew

I got the idea with GIT_SEQUENCE_EDITOR from
http://stackoverflow.com/questions/12394166 .

You can wrap that in a function or script:

pass-gen-edit () {
  # $1 name
  # $2 length
  pass generate -n "$1" "$2"
  pass edit "$1"
  GIT_SEQUENCE_EDITOR='sed -i "2 s/^pick/fixup/"' pass git rebase -i HEAD~2
  pass show -c "$1"

You can easily test this and remove the entry from your git history
again with `pass git reset --hard HEAD~1`.

Have fun and don't delete your important passwords with to much
`pass git`-magic :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20160716/f18b140d/attachment.asc>

More information about the Password-Store mailing list