Description¶
This script appends all PNG files found in a given directory to REPLICATION.md as markdown image links, sorted by filename. It is a pure-Python equivalent of the retired add-png.sh, so it can also be run via the 7-add-png Bitbucket pipeline without requiring bash, Python, or any tooling on the user’s own machine.
Usage¶
python3 tools/add-png.py <directory>Parameters¶
directory (required) - Directory containing the PNG files to append
Output¶
For each *.png file found directly in <directory> (non-recursive), appends a block like the following to REPLICATION.md at the repository root:
**filename.png**
Image paths are written relative to the repository root.
Examples¶
# Append PNGs from the generated graphics directory
python3 tools/add-png.py generated/graphsErrors¶
Exits with an error if no directory argument is given
Exits with an error if the given path is not a directory
Exits with an error if
REPLICATION.mdcannot be found at the repository rootPrints a message (without failing) if no PNG files are found in the directory
See Also¶
Pipeline
7-add-pngin bitbucket-pipelines .yml - runs this script from the Bitbucket web UI generate_png_diff.sh - Generate visual diffs for modified PNG images