bin/addcontact @ 6c4c335faf47

Merge
author Steve Losh <steve@stevelosh.com>
date Tue, 06 Aug 2024 10:56:16 -0400
parents dbc095424fd1
children (none)
#!/usr/bin/env bash

set -euo pipefail

# USAGE: addcontact 'Kevin Wu <kevinwuhoo@gmail.com>'

RAW="$1"

EMAIL="$(echo "$1" | grep -Po '<.+>' | tr -d '<>')"
NAME="$(echo "$1" | sed -e 's/ [^ ]*$//')"

printf "$EMAIL"'\t'"$NAME"'\t\n' >> ~/.contacts