1
0
Fork 0

bin: passget handle URLs with schemes

This commit is contained in:
Jeremy Kaplan 2021-01-19 20:41:32 -08:00
commit 6d7bb763dd

View file

@ -16,7 +16,11 @@ set -euo pipefail
# TODO: Print vault name instead of ID # TODO: Print vault name instead of ID
url="$1" # This cannot be done easily with simple replacement. It actually needed
# "real" regexes!
#
# shellcheck disable=SC2001
url=$(sed -E 's%https?://%%' <<< "$1")
mapfile -t matches < <(op list items | jq -c '.[] | select(.overview.url and (.overview.url | contains("'"${url}"'"))) | { uuid: .uuid, url: .overview.url, vault: .vaultUuid }') mapfile -t matches < <(op list items | jq -c '.[] | select(.overview.url and (.overview.url | contains("'"${url}"'"))) | { uuid: .uuid, url: .overview.url, vault: .vaultUuid }')
if [ "${#matches[@]}" -eq 0 ]; then if [ "${#matches[@]}" -eq 0 ]; then