#!/usr/bin/env bash

set -e

function rki() {
    docker run \
        -it \
        -v $PWD/renelick:/home/renelick/renelick \
        --entrypoint= \
        renelick \
        python3 -m renelick.client.main $@
}

rki --help | aha > docs/include/cli-help.html
dos2unix docs/include/cli-help.html

python3 -c "\
from bs4 import BeautifulSoup

html_path = 'docs/include/cli-help.html'
with open(html_path, encoding='utf-8') as html_file:
    html = BeautifulSoup(html_file.read())
with open(html_path, 'w', encoding='utf-8') as html_file:
    for item in html.body.pre.contents[1:]:
        html_file.write(str(item))
"

echo "Now open docs/include/cli-help.html and fine-tune by hand"

exit 0
