improved some minor things
This commit is contained in:
parent
949d80365c
commit
c7d5ac08ab
41
protonkey
41
protonkey
@ -1,23 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Copyright (c) 2022 Emma Tebibyte
|
# Copyright (c) 2022–2023 Emma Tebibyte <emma@tebibyte.media>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
#
|
#
|
||||||
# Protonkey is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it under
|
||||||
# under the terms of the GNU Affero General Public License as published by the
|
# the terms of the GNU Affero General Public License as published by the Free
|
||||||
# Free Software Foundation, either version 3 of the License, or (at your
|
# Software Foundation, either version 3 of the License, or (at your option) any
|
||||||
# option) any later version.
|
# later version.
|
||||||
#
|
#
|
||||||
# Protonkey is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
# details.
|
# details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License along
|
||||||
# along with this program. If not, see https://www.gnu.org/licenses/.
|
# with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
|
|
||||||
|
|
||||||
|
argv0="$0"
|
||||||
|
|
||||||
if test -z "$1"; then
|
if test -z "$1"; then
|
||||||
printf "Usage: %s [ProtonMail address]\n" "$0" 1>&2
|
printf "Usage: %s [ProtonMail address...]\n" "$argv0" 1>&2
|
||||||
exit 64 # syexits(3) EX_USAGE
|
exit 64 # syexits(3) EX_USAGE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -31,13 +34,15 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
URL="https://api.protonmail.ch/pks/lookup?op=get&search=$1"
|
while test -n "$1"; do
|
||||||
RESPONSE="$(curl -s "$URL")"
|
URL="https://api.protonmail.ch/pks/lookup?op=get&search=$1"
|
||||||
|
RESPONSE="$(curl -s "$URL")"
|
||||||
|
|
||||||
if [ "$RESPONSE" = 'No key found' ]; then
|
if [ "$RESPONSE" = 'No key found' ]; then
|
||||||
printf "%s\n" "$RESPONSE" 1>&2
|
printf "%s: %s: %s\n" "$argv0" "$1" "$RESPONSE" 1>&2
|
||||||
exit 76 # sysexits(3) EX_PROTOCOL
|
exit 76 # sysexits(3) EX_PROTOCOL
|
||||||
else
|
else
|
||||||
printf "%s\n" "$RESPONSE"
|
printf "%s\n" "$RESPONSE"
|
||||||
exit 0
|
fi
|
||||||
fi
|
shift
|
||||||
|
done
|
||||||
|
Reference in New Issue
Block a user