Skip to content

Instantly share code, notes, and snippets.

@notpushkin
Last active June 7, 2020 01:15
Show Gist options
  • Save notpushkin/86cbe7eaf1d8654872fffad005b5478e to your computer and use it in GitHub Desktop.
Save notpushkin/86cbe7eaf1d8654872fffad005b5478e to your computer and use it in GitHub Desktop.
Enhanced manpage generator for Docker (WIP prototype)
#: Takes data from https://github.com/docker/docker.github.io/blob/master/_data/engine-cli/
#: and produces markdown suitable for conversion to a manpage (e. g. using pandoc).
template = lambda cmd: f"""
%docker-{cmd["command"].replace(" ", "-")}(1)
# NAME
docker {cmd["command"]} - {cmd["short"]}
# SYNOPSIS
{cmd["usage"]}
# DESCRIPTION
{cmd["long"]}
# OPTIONS
{format_options(cmd["options"])}
# EXAMPLES
{cmd["examples"]}
# SEE ALSO
**{cmd["pname"].replace(" ", "-")}**(1)
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment