Skip to content

Commit

Permalink
Avoid calling gpg twice to decode the index for two different needed …
Browse files Browse the repository at this point in the history
…values.Update copyright date.
  • Loading branch information
dcreemer committed Jun 19, 2019
1 parent 93e14d8 commit c926d25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions 1pass
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
set -e
set -o pipefail

VERSION="1.1"
VERSION="1.1.1"

if [ "$XDG_CONFIG_HOME" != "" ] && [ ! -d "${HOME}/.1pass" ]; then
op_dir="${XDG_CONFIG_HOME}/1pass"
Expand Down Expand Up @@ -356,8 +356,9 @@ get_by_title()
if [ ! -r $index ] || [ $refresh -eq 1 ]; then
fetch_index
fi
local uuid=$(gpg -qd $index | jq -r ".[] | select(.overview.title==\"${title}\").uuid")
local tid=$(gpg -qd $index | jq -r ".[] | select(.overview.title==\"${title}\").templateUuid")
# read both uuid and templateUuid. Complicated call is so that we only call GPG once
q=".[] | select(.overview.title==\"${title}\").uuid + \":\" + select(.overview.title==\"${title}\").templateUuid"
IFS=: read uuid tid <<< $(gpg -qd $index | jq -r "${q}")
if [ "$tid" != "" ]; then
get_${tid} $uuid $field
if [ $? ]; then
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ non-interactive scripts less useful.

## License

Copyright (c) 2017, David Creemer (twitter: [@dcreemer](https://twitter.com/dcreemer)) with some
components from other GPL 2+ software.
Copyright (c) 2017-2019, David Creemer (twitter:
[@dcreemer](https://twitter.com/dcreemer)) with some components from other GPL 2+
software.

[GPL3](https://raw.githubusercontent.com/dcreemer/1pass/master/LICENSE)

Expand Down

0 comments on commit c926d25

Please sign in to comment.