~whynothugo/dotfiles

23ab4edf8f35a907e52b1129a007b87d25da25a3 — Hugo Osvaldo Barrera a month ago f287b1d
himitsu-mutt: Split into its own repo/package
2 files changed, 1 insertions(+), 54 deletions(-)

D home/.local/bin/himitsu-mutt
M sysconfig/PKGBUILD
D home/.local/bin/himitsu-mutt => home/.local/bin/himitsu-mutt +0 -54
@@ 1,54 0,0 @@
#!/bin/sh
#
# A helper for neomutt to read password from himitsu only when required. This
# is designed to be used together with `account_command`, and will read the
# password only when required (e.g.: the SMTP password will be read only when
# sending an email). Himitu's agent will show an interactive prompt to confirm
# disclosing the password to neomutt.
#
# Neomutt's configuration should contain something like:
#
#     set smtp_url = "smtps://my-username@smtp.example.com"
#     set account_command = "himitsu-mutt"
#
# Defining the username is mutt's configuration is optional; if one is not
# defined, then it will be read from himitsu as well.
#
# See: https://git.labrat.space/neomutt/commit/?h=upstream/heads/main&id=89ddbf7036cf8ec43c6923238ee26a9844cf86ac

set -eu

while [ $# -gt 0 ]; do
  case $1 in
    --hostname)
      HOSTNAME="$2"
      shift # past argument
      shift # past value
      ;;
    --username)
      USERNAME="$2"
      shift # past argument
      shift # past value
      ;;
    --type)
      PROTO="$2"
      shift # past argument
      shift # past value
      ;;
    *)
      echo "Unknown argument $1"
      exit 1
      ;;
  esac
done

# If no username was provided, get that from himitsu as well.
# The username is not expected to be secret.
if [ -z "${USERNAME+x}" ]; then
  USERNAME=$(hiq -1F username "proto=$PROTO" "host=$HOSTNAME")
  echo "username: $USERNAME"
fi

# Extract and print the password.
PASSWORD=$(hiq -dF password "proto=$PROTO" "host=$HOSTNAME" "username=$USERNAME")
echo "password: $PASSWORD"

M sysconfig/PKGBUILD => sysconfig/PKGBUILD +1 -0
@@ 67,6 67,7 @@ depends=(
  darkman
  gammastep
  himitsu
  himitsu-mutt
  hunspell-de
  hunspell-en_gb
  hunspell-es_ar