Re:Pure Java Typesetting System
by patrec on Monday January 23, 2023 @05:13PM
(#34495867)
Wouldn't something like the following shell one-liner rename get you quite close?
Untested, unoptimized, needs gnu grep and perl's rename utility (variously packaged as prename or rename-files, as opposed to the crappy linux-utils rename).
[ Parent
| on HN ]
Here you are, "gradle build" works with this cleaned up and faster version (and the diff looks plausible on first sight):
javas=$(find . -regex '.*\.java$')
sed -i -E "$(printf 's/\\<(%s)\\>/Kt\\1/g;' $(grep -hrPo '\b(class|interface|record|enum) (?!Kt)(?!List\b)(?!Entry\b)\K[A-Z]\w+'))" $(echo $javas);
rename 's;\b(?!Kt)(\w+[.]java)$;Kt$1;' $(echo $javas)
(The $(echo $javas) is so it works in both bash and zsh).