replace semicolons with greek questionmarks
This commit is contained in:
parent
95866bca81
commit
564b0cd011
|
@ -0,0 +1,34 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
def greek(path: str):
|
||||
"""replace all semicolons in the given file with Greek question marks"""
|
||||
contents: str = ""
|
||||
with open(path, "r") as file:
|
||||
contents = file.read()
|
||||
contents = contents.replace(";", "\u037e")
|
||||
with open(path, "w") as file:
|
||||
file.write(contents)
|
||||
file.flush()
|
||||
|
||||
def main():
|
||||
"""
|
||||
Turn all semicolons ';' of the target files into Greek question marks ';'.
|
||||
|
||||
For compilers and interpreters, this is a completely different character,
|
||||
but to humans, it looks the same. The Rust compiler is smart enough to warn
|
||||
us that it only looks like a semicolon. Use more Rust.
|
||||
"""
|
||||
if sys.argv.__len__() < 2:
|
||||
print("provide filepaths as arguments")
|
||||
|
||||
paths: list[str] = []
|
||||
for index, arg in enumerate(sys.argv):
|
||||
if os.path.exists(arg) and os.path.isfile(arg) and index > 0:
|
||||
paths.append(arg)
|
||||
|
||||
for path in paths:
|
||||
greek(path)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue