+prompt_userid_exists() {
+ local userID="$1"
+ local gpgOut
+ local fingerprint
+
+ if gpgOut=$(gpg_host_list_keys "=${userID}" 2>/dev/null) ; then
+ fingerprint=$(echo "$gpgOut" | grep '^fpr:' | cut -d: -f10)
+ if [ "$PROMPT" != "false" ] ; then
+ printf "Service name '%s' is already being used by key '%s'.\nAre you sure you want to use it again? (y/N) " "$fingerprint" "$userID" >&2
+ read OK; OK=${OK:=N}
+ if [ "${OK/y/Y}" != 'Y' ] ; then
+ failure "Service name not added."
+ fi
+ else
+ log info "Key '%s' is already using the service name '%s'." "$fingerprint" "$userID" >&2
+ fi
+ fi
+}
+
+# run command looped over keys
+multi_key() {
+ local cmd="$1"
+ shift
+ local keys=$@
+ local i=0
+ local fprs=($(list_primary_fingerprints <"$HOST_KEY_FILE"))
+ local key
+
+ check_no_keys
+
+ if [[ -z "$1" || "$1" == '--all' ]] ; then
+ keys="${fprs[@]}"
+ fi
+
+ for key in $keys ; do
+ if (( i++ > 0 )) ; then
+ echo "##############################"
+ fi
+ eval "$cmd" "$key"
+ done
+}
+
+# show info about the a key