"""Export PUDL table and field metadata to RST for use in documentation."""
import pathlib
import sys
import click
import pudl.logging_helpers
from pudl.metadata.classes import Package
from pudl.metadata.resources import RESOURCE_METADATA
[docs]
logger = pudl.logging_helpers.get_logger(__name__)
@click.command(
context_settings={"help_option_names": ["-h", "--help"]},
)
@click.option(
"--skip",
"-s",
help=(
"Name of a table that should be skipped and excluded from RST output. "
"Use this option multiple times to skip multiple tables."
),
type=str,
default=[],
multiple=True,
)
@click.option(
"--output",
"-o",
type=click.Path(),
default=None,
help="Path to which the RST output should be written. Defaults to STDOUT.",
)
@click.option(
"--docs-dir",
"-d",
type=click.Path(
exists=True,
dir_okay=True,
file_okay=False,
resolve_path=True,
path_type=pathlib.Path,
writable=True,
),
default=pathlib.Path().cwd() / "docs",
help=(
"Path to the PUDL repository docs directory. "
"Must exist and be writable. Defaults to ./docs/"
),
)
@click.option(
"--logfile",
help="If specified, write logs to this file.",
type=click.Path(
exists=False,
resolve_path=True,
path_type=pathlib.Path,
),
)
@click.option(
"--loglevel",
default="INFO",
type=click.Choice(
["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"], case_sensitive=False
),
)
if __name__ == "__main__":
sys.exit(metadata_to_rst())