前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
import sys from typing import List
""" # $* : -c advice.detachedHead=false clone --depth 1 --branch main https://github.com/frida/glib.git glib # new_args : -c advice.detachedHead=false clone --depth 1 --branch main git@gitcode.net/dependency/frida/glib.git glib """ """ ['D:\\pubx\\git-replace\\replace_url.py', '-c', 'advice.detachedHead=false', 'clone', '--depth', '1', '--branch', 'main', 'https://github.com/frida/glib.git', 'glib'] """ from repo_map import repo_url_map def processWordK(wordK:str)->str: if wordK.startswith("https://github.com"): if repo_url_map.__contains__(wordK): return repo_url_map.__getitem__(wordK) else: return wordK else: return wordK new_list:List[str]=list(map(lambda wordK:processWordK(wordK), sys.argv[1:])) new_arg:str=" ".join(new_list) print(new_arg)