Print message if no found contact
This commit is contained in:
parent
4d900c53ba
commit
556a4fd2db
10
kmail.sh
10
kmail.sh
|
@ -39,12 +39,20 @@ case "$#" in
|
||||||
esac
|
esac
|
||||||
# ]]]
|
# ]]]
|
||||||
|
|
||||||
debug_message "Look for a contact with these informations:\n${contact_pattern}"
|
debug_message "− Look for a contact with these informations:\n${contact_pattern}"
|
||||||
|
{
|
||||||
contact_line=$(khard email "${contact_pattern}" | sed -n 2p)
|
contact_line=$(khard email "${contact_pattern}" | sed -n 2p)
|
||||||
|
} > /dev/null
|
||||||
|
|
||||||
|
if [ -n "${contact_line}" ]; then
|
||||||
debug_message "Matching contact:\n${contact_line}"
|
debug_message "Matching contact:\n${contact_line}"
|
||||||
|
|
||||||
contact_mail=$(printf '%s' "${contact_line}" | awk '{print $NF}')
|
contact_mail=$(printf '%s' "${contact_line}" | awk '{print $NF}')
|
||||||
debug_message "Mail of this contact:\n${contact_mail}"
|
debug_message "Mail of this contact:\n${contact_mail}"
|
||||||
|
else
|
||||||
|
debug_message "− Found no email addresses corresponding to the argument(s)."
|
||||||
|
contact_mail="NO_CONTACT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Print the message to X11
|
# Print the message to X11
|
||||||
printf '%s' "${contact_mail}" | xdotool type --clearmodifiers --file -
|
printf '%s' "${contact_mail}" | xdotool type --clearmodifiers --file -
|
||||||
|
|
Loading…
Reference in New Issue