Kind of shi that half works
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
from pathlib import Path
|
||||
|
||||
def main():
|
||||
def main(args):
|
||||
# Set the directory path
|
||||
script_dir = Path(__file__).resolve().parent
|
||||
dir_path = Path("")
|
||||
|
||||
# Use the current script's directory or specify a path
|
||||
base_path = Path(__file__).resolve().parent
|
||||
|
||||
for entry in dir_path.iterdir():
|
||||
if entry.is_dir():
|
||||
print(f"[FOLDER] {entry.name}")
|
||||
elif entry.is_file():
|
||||
print(f"[FILE] {entry.name}")
|
||||
if args == []:
|
||||
for entry in dir_path.iterdir():
|
||||
if entry.is_dir():
|
||||
print(f"[FOLDER] {entry.name}")
|
||||
elif entry.is_file():
|
||||
print(f"[FILE] {entry.name}")
|
||||
elif args == ["--help"] or args == ["-h"]:
|
||||
print("Bro is lazy on doing this help section")
|
||||
|
||||
0
scripts/make_file/__init__.py
Normal file
0
scripts/make_file/__init__.py
Normal file
0
scripts/make_file/config.txt
Normal file
0
scripts/make_file/config.txt
Normal file
10
scripts/make_file/make_file.py
Normal file
10
scripts/make_file/make_file.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from pathlib import Path
|
||||
|
||||
def main(args):
|
||||
for target in args:
|
||||
path = Path(target)
|
||||
if path.exists():
|
||||
print(f'"{target}" already exists.')
|
||||
continue
|
||||
|
||||
path.write_text("") # Pure creation
|
||||
0
scripts/remove/__init__.py
Normal file
0
scripts/remove/__init__.py
Normal file
0
scripts/remove/config.txt
Normal file
0
scripts/remove/config.txt
Normal file
5
scripts/remove/remove.py
Normal file
5
scripts/remove/remove.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
def main(args):
|
||||
for item in args:
|
||||
Path(args).unlink(missing_ok=True) # missing_ok=True prevents error if file is missing
|
||||
0
scripts/say_greeting/config.txt
Normal file
0
scripts/say_greeting/config.txt
Normal file
@@ -1,2 +1,2 @@
|
||||
def main():
|
||||
def main(arg):
|
||||
print("Hi!")
|
||||
0
scripts/touch_file/__init__.py
Normal file
0
scripts/touch_file/__init__.py
Normal file
0
scripts/touch_file/config.txt
Normal file
0
scripts/touch_file/config.txt
Normal file
6
scripts/touch_file/touch_file.py
Normal file
6
scripts/touch_file/touch_file.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from pathlib import Path
|
||||
|
||||
def main(args):
|
||||
for target in args:
|
||||
path = Path(target)
|
||||
path.touch(exist_ok=True)
|
||||
Reference in New Issue
Block a user