Skip to content

Commit b0b8cec

Browse files
committed
Add --title parameter
Signed-off-by: Sylvain Hellegouarch <[email protected]>
1 parent 6fb36ad commit b0b8cec

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
## [Unreleased][]
44

5-
[Unreleased]: https://github.com/chaostoolkit/chaostoolkit-reporting/compare/0.16.0...HEAD
5+
[Unreleased]: https://github.com/chaostoolkit/chaostoolkit-reporting/compare/0.17.0...HEAD
6+
7+
## [0.17.0][] - 2024-01-05
8+
9+
[0.17.0]: https://github.com/chaostoolkit/chaostoolkit-reporting/compare/0.16.0...0.17.0
10+
11+
### Added
12+
13+
- The `--title` option to the `report` command so you can force the title
14+
in the report header
615

716
## [0.16.0][] - 2023-12-05
817

chaosreport/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"generate_report_header",
3535
"save_report",
3636
]
37-
__version__ = "0.16.0"
37+
__version__ = "0.17.0"
3838

3939
curdir = os.getcwd()
4040
basedir = os.path.dirname(__file__)
@@ -43,12 +43,14 @@
4343

4444

4545
def generate_report_header(
46-
journal_paths: List[str], export_format: str = "markdown"
46+
journal_paths: List[str],
47+
export_format: str = "markdown",
48+
title: str = None,
4749
) -> str:
4850
header_template = get_report_template(None, "header.md")
4951

5052
header_info = {}
51-
header_info["title"] = "Chaos Engineering Report"
53+
header_info["title"] = "Chaos Engineering Report" or title
5254
header_info["today"] = datetime.now().strftime("%d %B %Y")
5355
header_info["export_format"] = export_format
5456
tags = []

chaosreport/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def validate_vars(
2929

3030

3131
@click.command()
32+
@click.option(
33+
"--title",
34+
help="Title to use in the header of the report",
35+
)
3236
@click.option(
3337
"--export-format",
3438
default="markdown",
@@ -63,11 +67,12 @@ def report(
6367
var_file: List[str] = None,
6468
journal: str = "journal.json",
6569
report: str = "report.md",
70+
title: str = None,
6671
):
6772
"""
6873
Generate a report from the run journal(s).
6974
"""
70-
header = generate_report_header(journal, export_format)
75+
header = generate_report_header(journal, export_format, title)
7176
report_path = report
7277
reports = []
7378

0 commit comments

Comments
 (0)