From 6d7bb763ddec051344734c44944d98d3657e0101 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Tue, 19 Jan 2021 20:41:32 -0800 Subject: [PATCH] bin: passget handle URLs with schemes --- bin/passget | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/passget b/bin/passget index 864d520..74260c1 100755 --- a/bin/passget +++ b/bin/passget @@ -16,7 +16,11 @@ set -euo pipefail # 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 }') if [ "${#matches[@]}" -eq 0 ]; then