Skip to content

Instantly share code, notes, and snippets.

@AndrewReitz
Created March 10, 2022 15:54
Show Gist options
  • Save AndrewReitz/2dfc835c7676f511f1ec8fc5445c5504 to your computer and use it in GitHub Desktop.
Save AndrewReitz/2dfc835c7676f511f1ec8fc5445c5504 to your computer and use it in GitHub Desktop.
Python gradle.kts to libs.version.toml script
import pyperclip
import time
import re
reg = re.compile("\"[A-Za-z0-9:-]+\"")
while True:
inp = pyperclip.paste()
t = reg.findall(inp)
if len(t) == 0:
time.sleep(1)
continue
print(t)
totalResult = ""
for i in t:
text = i.replace("\"", "")
splits = text.split(":")
if len(splits) >= 2:
print(splits)
fullResult = "projects"
for module in splits[1:]:
print(module)
instacartModule = module.split("-")
print(instacartModule)
result = instacartModule[0]
for x in instacartModule[1:]:
result += x.capitalize()
fullResult += "."
fullResult += result
fullResult += ","
fullResult += "\n"
totalResult += fullResult
print(totalResult)
if totalResult != "":
pyperclip.copy(totalResult)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment