2019-07-14 09:47:38 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2021-03-05 08:26:03 +00:00
|
|
|
import sys
|
2023-10-25 01:03:35 +01:00
|
|
|
from os import path
|
|
|
|
|
2019-07-14 09:47:38 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
try:
|
|
|
|
import click
|
2023-10-25 01:03:35 +01:00
|
|
|
import towncrier
|
2019-07-14 09:47:38 +01:00
|
|
|
except ImportError:
|
2019-07-24 00:33:04 +01:00
|
|
|
print(
|
|
|
|
"Please make sure you have a installed towncrier and click before using this tool"
|
|
|
|
)
|
2021-03-05 08:26:03 +00:00
|
|
|
sys.exit(1)
|
2019-07-14 09:47:38 +01:00
|
|
|
|
|
|
|
@click.command()
|
|
|
|
@click.option(
|
|
|
|
"--draft",
|
|
|
|
"draft",
|
|
|
|
default=False,
|
|
|
|
flag_value=True,
|
2019-07-24 00:33:04 +01:00
|
|
|
help="Render the news fragments, don't write to files, "
|
|
|
|
"don't check versions.",
|
|
|
|
)
|
2023-10-25 04:13:13 +01:00
|
|
|
@click.option("--dir", "directory", default=path.dirname(path.abspath(__file__)))
|
2019-07-14 09:47:38 +01:00
|
|
|
@click.option("--name", "project_name", default=None)
|
|
|
|
@click.option(
|
|
|
|
"--version",
|
|
|
|
"project_version",
|
|
|
|
default=None,
|
|
|
|
help="Render the news fragments using given version.",
|
|
|
|
)
|
|
|
|
@click.option("--date", "project_date", default=None)
|
|
|
|
@click.option(
|
|
|
|
"--yes",
|
|
|
|
"answer_yes",
|
|
|
|
default=False,
|
|
|
|
flag_value=True,
|
|
|
|
help="Do not ask for confirmation to remove news fragments.",
|
|
|
|
)
|
2019-07-24 00:33:04 +01:00
|
|
|
def _main(
|
|
|
|
draft,
|
|
|
|
directory,
|
|
|
|
project_name,
|
|
|
|
project_version,
|
|
|
|
project_date,
|
|
|
|
answer_yes,
|
|
|
|
):
|
2019-07-14 09:47:38 +01:00
|
|
|
return towncrier.__main(
|
2019-07-24 00:33:04 +01:00
|
|
|
draft,
|
|
|
|
directory,
|
|
|
|
project_name,
|
|
|
|
project_version,
|
|
|
|
project_date,
|
|
|
|
answer_yes,
|
2019-07-14 09:47:38 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
_main()
|