Skip to content

Commit 641e13e

Browse files
committed
Add command which was run to the markdown piece
1 parent 2401290 commit 641e13e

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

tagging/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ from tagging.manifests import ManifestInterface, quoted_output
108108
class AptPackagesManifest(ManifestInterface):
109109
@staticmethod
110110
def markdown_piece(container) -> str:
111-
return "\n".join(
112-
["## Apt Packages", "", quoted_output(container, "apt list --installed")]
113-
)
111+
return f"""\
112+
## Apt Packages
113+
114+
{quoted_output(container, "apt list --installed")}"""
114115
```
115116

116117
- `quoted_output` simply runs the command inside a container using `DockerRunner.run_simple_command` and wraps it to triple quotes to create a valid markdown piece.
118+
It also adds the command which was run to the markdown piece.
117119
- `manifests.py` contains all the manifests.
118120
- `write_manifest.py` is a python executable which is used to create the build manifest and history line for an image.
119121

tagging/manifests.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def quoted_output(container: Container, cmd: str) -> str:
1616
# For example, R packages list contains trailing backspaces
1717
cmd_output = "\n".join(line.rstrip() for line in cmd_output.split("\n"))
1818
return f"""\
19+
`{cmd}`:
20+
1921
```text
2022
{cmd_output}
2123
```"""
@@ -74,12 +76,8 @@ def markdown_piece(container: Container) -> str:
7476
7577
{DockerRunner.run_simple_command(container, "python --version")}
7678
77-
`mamba info --quiet`:
78-
7979
{quoted_output(container, "mamba info --quiet")}
8080
81-
`mamba list`:
82-
8381
{quoted_output(container, "mamba list")}"""
8482

8583

@@ -89,8 +87,6 @@ def markdown_piece(container: Container) -> str:
8987
return f"""\
9088
## Apt Packages
9189
92-
`apt list --installed`:
93-
9490
{quoted_output(container, "apt list --installed")}"""
9591

9692

0 commit comments

Comments
 (0)