#!/bin/bash
set -e
set -o pipefail

date_string="$(date -u +%F -d "$(dpkg-parsechangelog -S Date)")"
version_string="$(dpkg-parsechangelog -S Version | cut -d- -f-1)"

# Fake presence of curl for ./letsencrypt.sh
curl(){ return 0; } && export -f curl

# Provide manpage header and intro
cat <<EOF
.TH "letsencrypt.sh" "1" "$date_string" "$version_string" "The letsencrypt.sh ACME client"
.SH NAME
letsencrypt.sh - ACME client implemented in Bash
.SH DESCRIPTION
.B letsencrypt.sh
is a client for signing certificates with an ACME-server implemented as a
relatively simple Bash script. It can be used with the Let’s Encrypt
certificate authority (letsencrypt.org).
.SH OPTIONS
EOF

# Provide usage information
./letsencrypt.sh --help | sed -r 's|\./(letsencrypt.sh)|\1|'

# Add a final newline
echo

