Merge pull request #254731 from nbraud/aliases/script

This commit is contained in:
Maciej Krüger 2023-09-12 15:14:16 +02:00 committed by GitHub
commit 33af7f107d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,12 +102,13 @@ def convert_to_throw(date_older_list: list[str]) -> list[tuple[str, str]]:
alias = before_equal
alias_unquoted = before_equal.strip('"')
after_equal_list = [x.strip(";:") for x in after_equal.split()]
replacement = next(x.strip(";:") for x in after_equal.split())
replacement = replacement.removeprefix("pkgs.")
converted = (
f"{indent}{alias} = throw \"'{alias_unquoted}' has been renamed to/replaced by"
f" '{after_equal_list.pop(0)}'\";"
f' # Converted to throw {datetime.today().strftime("%Y-%m-%d")}'
f"{indent}{alias} = throw \"'{alias_unquoted}' has been"
f" renamed to/replaced by '{replacement}'\";"
f" # Converted to throw {datetime.today().strftime('%Y-%m-%d')}"
)
converted_list.append((line, converted))