<div dir="ltr">Nobody interested by this patch ?</div><div class="gmail_extra"><br clear="all"><div><div style="text-align:left"><div style="background-color:rgb(255,255,255)"><div style="text-align:-webkit-auto"><b><font color="#33ccff"><font color="#000000">--------</font><br>
Johan</font><span style="color:rgb(153,153,153)"> Venant.</span></b></div><div style="text-align:-webkit-auto"><font size="1"><font color="#33ccff">Tel :</font><font color="#999999"><b> </b>+33 6 13 06 95 43</font></font></div>
<div style="text-align:-webkit-auto"><font color="#33ccff" size="1"><b><a href="http://www.invicem.pro" target="_blank">www.invicem.pro</a></b></font></div><div style="text-align:-webkit-auto"><font color="#999999" size="1"><br>
</font></div></div></div><div style="text-align:left"><img src="https://sites.google.com/a/invicem.pro/calendar/logo/logo_228604_1_color_100.jpg?attredirects=0"><br></div><div style="text-align:left"><br></div></div>
<br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 3:17 PM, Johan Venant <span dir="ltr"><<a href="mailto:jvenant@invicem.pro" target="_blank">jvenant@invicem.pro</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Made a little mistake : forgot the ":" after field in opts</div><div class="gmail_extra"><br clear="all"><div><div style="text-align:left"><div style><div style="text-align:-webkit-auto">
<b><font color="#33ccff"><font color="#000000">--------</font><br>Johan</font><span style="color:rgb(153,153,153)"> Venant.</span></b></div><div style="text-align:-webkit-auto"><font size="1"><font color="#33ccff">Tel :</font><font color="#999999"><b> </b><a href="tel:%2B33%206%2013%2006%2095%2043" value="+33613069543" target="_blank">+33 6 13 06 95 43</a></font></font></div>
<div style="text-align:-webkit-auto"><font color="#33ccff" size="1"><b><a href="http://www.invicem.pro" target="_blank">www.invicem.pro</a></b></font></div><div style="text-align:-webkit-auto"><font color="#999999" size="1"><br>
</font></div></div></div><div style="text-align:left"><img src="https://sites.google.com/a/invicem.pro/calendar/logo/logo_228604_1_color_100.jpg?attredirects=0"><br></div><div style="text-align:left"><br></div></div><div>
<div class="h5">
<br><br><div class="gmail_quote">On Wed, Mar 26, 2014 at 9:46 AM, jvenant <span dir="ltr"><<a href="mailto:jvenant@invicem.pro" target="_blank">jvenant@invicem.pro</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Add the capacity to output or copy in the clipboard only<br>
the specified field instead of the password.<br>
Using the standard format : <field>: <value> in the password data<br>
---<br>
src/password-store.sh | 21 ++++++++++++++++-----<br>
1 file changed, 16 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/password-store.sh b/src/password-store.sh<br>
index c576844..05ff927 100755<br>
--- a/src/password-store.sh<br>
+++ b/src/password-store.sh<br>
@@ -230,12 +230,14 @@ case "$command" in<br>
;;<br>
show|ls|list)<br>
clip=0<br>
+ field=""<br>
<br>
- opts="$($GETOPT -o c -l clip -n "$program" -- "$@")"<br>
+ opts="$($GETOPT -o cf: -l clip,field -n "$program" -- "$@")"<br>
err=$?<br>
eval set -- "$opts"<br>
while true; do case $1 in<br>
-c|--clip) clip=1; shift ;;<br>
+ -f|--field) field="$2"; shift 2 ;;<br>
--) shift; break ;;<br>
esac done<br>
<br>
@@ -248,11 +250,20 @@ case "$command" in<br>
passfile="$PREFIX/$path.gpg"<br>
if [[ -f $passfile ]]; then<br>
if [[ $clip -eq 0 ]]; then<br>
- exec $GPG -d $GPG_OPTS "$passfile"<br>
+<br>
+ if [[ -n $field ]]; then<br>
+ exec $GPG -d $GPG_OPTS "$passfile" | sed -n "/^$field: / s/$field: //p"<br>
+ else<br>
+ exec $GPG -d $GPG_OPTS "$passfile"<br>
+ fi<br>
else<br>
- pass="$($GPG -d $GPG_OPTS "$passfile" | head -n 1)"<br>
- [[ -n $pass ]] || exit 1<br>
- clip "$pass" "$path"<br>
+ if [[ -n $field ]]; then<br>
+ field="$($GPG -d $GPG_OPTS "$passfile" | sed -n "/^$field: / s/$field: //p")"<br>
+ else<br>
+ field="$($GPG -d $GPG_OPTS "$passfile" | head -n 1)"<br>
+ fi<br>
+ [[ -n $field ]] || exit 1<br>
+ clip "$field" "$path"<br>
fi<br>
elif [[ -d $PREFIX/$path ]]; then<br>
if [[ -z $path ]]; then<br>
<span><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div></div></div>
</blockquote></div><br></div>