mirror of
https://github.com/Mic92/sops-nix.git
synced 2025-12-26 22:24:59 +08:00
25 lines
489 B
Python
25 lines
489 B
Python
from sys import argv
|
|
|
|
|
|
def substitute(target: str, subst: str) -> str:
|
|
with open(target) as f:
|
|
content = f.read()
|
|
|
|
with open(subst) as f:
|
|
subst_pairs = f.read().splitlines()
|
|
|
|
for pair in subst_pairs:
|
|
placeholder, path = pair.split()
|
|
with open(path) as f:
|
|
content = content.replace(placeholder, f.read())
|
|
|
|
return content
|
|
|
|
|
|
def main() -> None:
|
|
target = argv[1]
|
|
subst = argv[2]
|
|
print(substitute(target, subst))
|
|
|
|
|
|
main()
|