-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto update adt version output inside README
- Loading branch information
Showing
4 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!python3 | ||
"""Script that tests rule markdown documentation.""" | ||
from __future__ import annotations | ||
|
||
import re | ||
import subprocess | ||
|
||
from pathlib import Path | ||
|
||
|
||
if __name__ == "__main__": | ||
result = subprocess.run( | ||
"adt --version", # noqa: S607 | ||
shell=True, # noqa: S602 | ||
check=True, | ||
capture_output=True, | ||
text=True, | ||
) | ||
|
||
file = Path("README.md") | ||
with file.open(encoding="utf-8", mode="r+") as fh: | ||
content = fh.read() | ||
content = re.sub( | ||
"<!-- START -->(.*?)<!-- END -->", | ||
f"<!-- START -->\n\n```\n$ adt --version\n{result.stdout}```\n\n<!-- END -->", | ||
content, | ||
flags=re.DOTALL, | ||
) | ||
fh.seek(0) | ||
fh.write(content) | ||
fh.truncate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters