diff options
| author | Magnus Hagander | 2024-05-22 20:00:53 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2024-05-22 20:00:53 +0000 |
| commit | 1f0d59af35e5a4f9bc0b54b883302e9bfab992cb (patch) | |
| tree | 8a5a0ca7388be9aa31052c385369a5bddba476d8 /tools | |
| parent | 9945a2b91d122da2c0fc5ef9a4ae575ebff73332 (diff) | |
Teach fetch_sponsorfiles.py to optionally add downloaded files to git
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/deploystatic/fetch_sponsorfiles.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/deploystatic/fetch_sponsorfiles.py b/tools/deploystatic/fetch_sponsorfiles.py index 2b484950..86a7e7fd 100755 --- a/tools/deploystatic/fetch_sponsorfiles.py +++ b/tools/deploystatic/fetch_sponsorfiles.py @@ -10,6 +10,7 @@ import json import os import re import shutil +import subprocess import sys import unicodedata import urllib.request @@ -31,6 +32,7 @@ if __name__ == "__main__": parser.add_argument('benefitname', type=str, help='Benefit name to match') parser.add_argument('--overwrite', action='store_true') parser.add_argument('--verbose', action='store_true') + parser.add_argument('--gitadd', action='store_true', help='Run `git add` for any downloaded file') args = parser.parse_args() @@ -67,3 +69,7 @@ if __name__ == "__main__": with open(filename, 'wb') as f: shutil.copyfileobj(fresp, f) print("Downloaded {}".format(filename)) + if args.gitadd: + subprocess.run(args=['git', 'add', filename], check=True) + if args.verbose: + print("File {} added to git".format(filename)) |
