Add SUPERCOPY
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,3 +8,6 @@ __pycache__/
|
||||
*.pyt
|
||||
*.pyc.*
|
||||
*.pyo.*
|
||||
|
||||
# SUPERCOPY
|
||||
copy.md
|
||||
19
SUPERCOPY.py
Normal file
19
SUPERCOPY.py
Normal file
@@ -0,0 +1,19 @@
|
||||
files = [
|
||||
"core/file_search.py",
|
||||
"ui/gui.py"
|
||||
]
|
||||
|
||||
codeblock = "```"
|
||||
|
||||
copy = ""
|
||||
|
||||
for file in files:
|
||||
with open(file, "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
copy += f"### {file}\n\n"
|
||||
copy += f"{codeblock}python\n"
|
||||
copy += "".join(lines)
|
||||
copy += f"\n{codeblock}\n\n"
|
||||
|
||||
with open("copy.md", "w", encoding="utf-8") as f:
|
||||
f.write(copy)
|
||||
20
ui/ui.py
20
ui/ui.py
@@ -1,20 +0,0 @@
|
||||
import core.file_search as fs
|
||||
|
||||
def main():
|
||||
filename = input("Enter the filename: ")
|
||||
files = fs.find(filename, "~")
|
||||
for file in files:
|
||||
print(file)
|
||||
if len(files) == 0:
|
||||
print("I didn't find anything, would you like to try searching the whole disk?")
|
||||
answer = input("(y/n): ")
|
||||
if answer.lower() == 'y':
|
||||
files = fs.find(filename)
|
||||
if len(files) == 0:
|
||||
print("No files found on the whole disk.")
|
||||
else:
|
||||
for file in files:
|
||||
print(file)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user