Page MenuHomeDevCentral

credentials-repo-replace.py

Authored By
dereckson
Jan 28 2024, 19:30
Size
856 B
Referenced Files
None
Subscribers
None

credentials-repo-replace.py

#!/usr/bin/env python3
import sys
# -------------------------------------------------------------
# Migrate : string replacement
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def migrate_all(orig_list, dest_list):
for orig, dest in zip(orig_list, dest_list):
migrate(orig, dest)
def migrate(orig, dest):
orig_re = orig.replace(".", "\.")
print(f"rg -l -F {orig} | xargs gsed -i s@{orig_re}@{dest}@g")
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def run(orig_file, dest_file):
orig_list = [line.strip() for line in open(orig_file)]
dest_list = [line.strip() for line in open(dest_file)]
migrate_all(orig_list, dest_list)
if __name__ == "__main__":
run("from", "to")

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1639360
Default Alt Text
credentials-repo-replace.py (856 B)

Event Timeline