[pass] copying usernames and urls

Brian Shore brian at networkredux.com
Tue May 6 17:50:00 CEST 2014

On Thu, May 1, 2014 at 3:15 PM, Brian Shore <brian at networkredux.com> wrote:
>> I would even go further, as I explained elsewhere already: remove from
>> pass the capability to copy stuff to the clipboard and the capability to
>> generate a password, and delegate this to a frontend (I'm not sure what
>> to do with the edit feature, it doesn't belong in this core-pass, but I
>> would still keep it as an emergency-repair tool). Just keep the
>> encryption and file-manipulation features (including git): pass thus
>> becomes a tool that manipulates files, shows the content of a file,
>> and allows to replace the whole content of a file at once, wihtout
>> making *any* kind of assumption about its content. For real, this time.
> I don't have that thread in front of me, so I'll hijack this one.  We could
> make it very easy to extend pass with external tools by copying git -- any
> subcommand (cp, mv, find, etc) that isn't in the core is sought in the PATH
> as pass-$subcommand.  So if you want a "pass find" command, just create a
> script named pass-find somewhere in your $ PATH.
> We can share info like the prefix by exporting to the environment. We keep
> the core small, we get a consistent interface.

If anyone is curious, the patch to enable this is small and looks
something like the below.  Exporting some additional variables might
be helpful at some point, this is really just a (working) proof of

I've tested the below with a trival script that just printed a few
lines of output to announce that it had been called.

This could allow the core of pass to remain small and allow extension
scripts to be called transparently.  One detractor from this approach
is that info about extension scripts would not appear in pass' usage

Note:  not git formatted, as this is just an idea for discussion at this point.

diff --git a/src/password-store.sh b/src/password-store.sh
index ad22833..45f66fc 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -15,6 +15,7 @@ PREFIX="${PASSWORD_STORE_DIR:-$HOME/.password-store}"

+export PREFIX

@@ -181,7 +182,10 @@ tmpdir() {
 SHRED="shred -f -z"

-source "$(dirname "$0")/platform/$(uname | cut -d _ -f 1 | tr
'[:upper:]' '[:lower:]').sh" 2>/dev/null # PLATFORM_FUNCTION_FILE
+export PASS_PLATFORM_FUNCTIONS="$(dirname "$0")/platform/$(uname |
cut -d _ -f 1 | tr '[:upper:]' '[:lower:]').sh"
+if [ -f "$PASS_PLATFORM_FUNCTIONS" ]; then

 # END platform definable
@@ -572,6 +576,15 @@ case "$1" in
        rename|mv) shift;               cmd_copy_move "move" "$@" ;;
        copy|cp) shift;                 cmd_copy_move "copy" "$@" ;;
        git) shift;                     cmd_git "$@" ;;
-       *) COMMAND="show";              cmd_show "$@" ;;
+       *)
+               COMMAND="pass-$1"
+               shift
+               if which "$COMMAND" >/dev/null ; then
+                       exec "$COMMAND" "$@"
+               else
+                       cmd_usage "$@"
+                       exit 1
+               fi
+               ;;
 exit 0

Brian Shore
Senior Systems Engineer, Security Architect
Network Redux, LLC
5200 SW Macadam Ave Ste 450
Portland, Oregon 97239
Desk:  503-274-9905 x503

More information about the Password-Store mailing list