#!/bin/sh
# Run by help2man as "debian/help2man-wrapper <script> --help|--version".
# Adapts the argparse output of the opentelemetry-* scripts for help2man:
#  * keep only the first line of the usage and write "Usage:", the only
#    spelling help2man turns into a SYNOPSIS;
#  * drop the options without description, generated by
#    opentelemetry-instrument from the installed OTEL_* environment
#    variables: they depend on the installed packages.
"$@" | sed \
	-e '/^usage:/,/^$/{/^usage:/!{/^$/!d}}' \
	-e 's/^usage:/Usage:/' \
	-e '/^  --[a-z0-9_]* [A-Z0-9_]*$/d'
