<div dir="ltr">I'm using a shell script with the following contents:<div><br></div><div>```</div><div><div>#!/usr/bin/env bash</div><div><br></div><div># This script needs to be sourced to affect the user's environment.</div><div><br></div><div>repo_name=$1</div><div><br></div><div>if [[ -z "$repo_name" ]]; then</div><div> echo "Error: No repo name was specified."</div><div> return 1</div><div>fi</div><div><br></div><div>repo_path="$HOME/.password-store/$repo_name"</div><div><br></div><div>if [[ ! -d "$repo_path" ]]; then</div><div> echo "Error: No Pass sub-directory with the name '$repo_name' exists."</div><div> return 1</div><div>fi</div><div><br></div><div>export PASSWORD_STORE_GIT="$repo_path"</div><div>export PASSWORD_STORE_DIR="$repo_path"</div><div><br></div><div>echo "Switched to repo '$repo_name'!"</div></div><div>```</div><div><br></div><div>I named the script *pass-switch-repo.bash* and keep it in *~/bin*.</div><div><br></div><div>Note that you have to source the script for the changes it makes to the environment variables to affect your current shell session, i.e. run `. ~/bin/pass-switch-repo.bash the-name-of-a-repo`.</div><div><br></div><div>You can still use Pass without having run (sourced) the script but the `pass git ...` commands won't work (unless you've also setup your Pass root directory as a Git repo).</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 19, 2016 at 6:00 AM, <span dir="ltr"><<a href="mailto:password-store-request@lists.zx2c4.com" target="_blank">password-store-request@lists.zx2c4.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send Password-Store mailing list submissions to<br>
<a href="mailto:password-store@lists.zx2c4.com">password-store@lists.zx2c4.com</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.zx2c4.com/mailman/listinfo/password-store" rel="noreferrer" target="_blank">http://lists.zx2c4.com/<wbr>mailman/listinfo/password-<wbr>store</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:password-store-request@lists.zx2c4.com">password-store-request@lists.<wbr>zx2c4.com</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:password-store-owner@lists.zx2c4.com">password-store-owner@lists.<wbr>zx2c4.com</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Password-Store digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Add 'Change Dir' Functionality (Jakob Holderbaum)<br>
2. Re: Add 'Change Dir' Functionality (Lucas Hoffmann)<br>
3. Re: Add 'Change Dir' Functionality (Brian Candler)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Sun, 18 Sep 2016 13:52:19 +0200<br>
From: Jakob Holderbaum <<a href="mailto:pass@jakob.io">pass@jakob.io</a>><br>
To: <a href="mailto:password-store@lists.zx2c4.com">password-store@lists.zx2c4.com</a><br>
Subject: [pass] Add 'Change Dir' Functionality<br>
Message-ID: <20160918115219.GA10016@<wbr>steppenwolf.fritz.box><br>
Content-Type: text/plain; charset="us-ascii"<br>
<br>
Hi pass Team,<br>
<br>
first and foremost, thanks for this great tool!<br>
We are currently using it at several client projects for storing shared team secrets like production credentials.<br>
<br>
This also means, that a rather often use-case is to call pass on different password directories. Setting PASSWORD_STORE_DIR individually for every call sometimes feels a bit awkward and let here and there even to mistakes.<br>
<br>
So I wan't to implement and submit a patch that basically implements the same 'Change Dir' functionality as it has been done for 'make' and 'git'.<br>
<br>
Both tools allow to specify the optional working dir with -C in front of the actual command. For example:<br>
<br>
`git -C ~/dev/dotfiles status`<br>
<br>
or<br>
<br>
`make -C ./build test`<br>
<br>
Wouldn't it be great if pass could provide the same interface:<br>
<br>
`pass -C ./secrets show production/database_password`<br>
<br>
instead of<br>
<br>
`PASSWORD_STORE_DIR=./secrets pass show production/database_password`<br>
<br>
If you think this would be a valuable extension, I would happily provide a patch for that.<br>
<br>
By the way, do you have any guidelines for submitting patches? I skimmed the pass website but could not find any.<br>
<br>
Thanks in advance!<br>
<br>
Cheers<br>
Jakob<br>
--<br>
Jakob Holderbaum<br>
<br>
<a href="http://jakob.io/" rel="noreferrer" target="_blank">http://jakob.io/</a> | <a href="mailto:jakob@holderbaum.io">jakob@holderbaum.io</a><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: signature.asc<br>
Type: application/pgp-signature<br>
Size: 801 bytes<br>
Desc: not available<br>
URL: <<a href="http://lists.zx2c4.com/pipermail/password-store/attachments/20160918/bbd5d700/attachment-0001.asc" rel="noreferrer" target="_blank">http://lists.zx2c4.com/<wbr>pipermail/password-store/<wbr>attachments/20160918/bbd5d700/<wbr>attachment-0001.asc</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sun, 18 Sep 2016 15:34:10 +0200<br>
From: Lucas Hoffmann <<a href="mailto:l-m-h@web.de">l-m-h@web.de</a>><br>
To: <a href="mailto:password-store@lists.zx2c4.com">password-store@lists.zx2c4.com</a><br>
Subject: Re: [pass] Add 'Change Dir' Functionality<br>
Message-ID: <147420565065.6026.<wbr>9624702959976314684@mbp><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Quoting Jakob Holderbaum (2016-09-18 13:52:19)<br>
> We are currently using it at several client projects for storing<br>
> shared team secrets like production credentials.<br>
><br>
> This also means, that a rather often use-case is to call pass on<br>
> different password directories. Setting PASSWORD_STORE_DIR<br>
> individually for every call sometimes feels a bit awkward and let here<br>
> and there even to mistakes.<br>
><br>
> So I wan't to implement and submit a patch that basically implements<br>
> the same 'Change Dir' functionality as it has been done for 'make' and<br>
> 'git'.<br>
<br>
There where similar questions on the list before (can't give you the<br>
link right now, you have to search the archives yourself) but one<br>
proposed solution was to define aliases in your shell:<br>
<br>
alias pass-team1='PASSWORD_STORE_<wbr>DIR=/somewhere/team1 pass'<br>
alias pass-team2='PASSWORD_STORE_<wbr>DIR=/somewhere/team2 pass'<br>
<br>
Or you can use subfolders in PASSWORD_STORE_DIR with different gpg ids<br>
and use something like git subtree or submodule to manage that (just in<br>
case you did not know, see man page).<br>
<br>
Lucas<br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: signature.asc<br>
Type: application/pgp-signature<br>
Size: 455 bytes<br>
Desc: signature<br>
URL: <<a href="http://lists.zx2c4.com/pipermail/password-store/attachments/20160918/43ec86be/attachment-0001.asc" rel="noreferrer" target="_blank">http://lists.zx2c4.com/<wbr>pipermail/password-store/<wbr>attachments/20160918/43ec86be/<wbr>attachment-0001.asc</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Sun, 18 Sep 2016 16:54:21 +0100<br>
From: Brian Candler <<a href="mailto:b.candler@pobox.com">b.candler@pobox.com</a>><br>
To: Jakob Holderbaum <<a href="mailto:pass@jakob.io">pass@jakob.io</a>>, <a href="mailto:password-store@lists.zx2c4.com">password-store@lists.zx2c4.com</a><br>
Subject: Re: [pass] Add 'Change Dir' Functionality<br>
Message-ID: <<a href="mailto:e7f30443-2979-984d-eb1b-bb699d970456@pobox.com">e7f30443-2979-984d-eb1b-<wbr>bb699d970456@pobox.com</a>><br>
Content-Type: text/plain; charset=windows-1252; format=flowed<br>
<br>
On 18/09/2016 12:52, Jakob Holderbaum wrote:<br>
> Both tools allow to specify the optional working dir with -C in front of the actual command. For example:<br>
><br>
> `git -C ~/dev/dotfiles status`<br>
><br>
> or<br>
><br>
> `make -C ./build test`<br>
><br>
> Wouldn't it be great if pass could provide the same interface:<br>
><br>
> `pass -C ./secrets show production/database_password`<br>
<br>
Another option I would like to see is to be able to use multiple git<br>
repos within the tree. This could then be combined with symlinks: e.g.<br>
<br>
.password_store/secrets -> /home/me/secrets<br>
.password_store/customer1 -> /home/me/customers/one/<wbr>password_store<br>
<br>
Then you could do:<br>
<br>
pass show secrets/production/database_<wbr>password<br>
<br>
as if it were were a single pass tree (but actually commits would take<br>
place within secrets/.git)<br>
<br>
Regards,<br>
<br>
Brian.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
Password-Store mailing list<br>
<a href="mailto:Password-Store@lists.zx2c4.com">Password-Store@lists.zx2c4.com</a><br>
<a href="http://lists.zx2c4.com/mailman/listinfo/password-store" rel="noreferrer" target="_blank">http://lists.zx2c4.com/<wbr>mailman/listinfo/password-<wbr>store</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Password-Store Digest, Vol 40, Issue 10<br>
******************************<wbr>****************<br>
</blockquote></div><br></div></div></div>