mirror of
https://github.com/m4rcel-lol/m5rcode.git
synced 2025-12-06 19:13:57 +05:30
Add files via upload
This commit is contained in:
committed by
GitHub
parent
af762526f5
commit
751062a706
16
commands/cmd_new.py
Normal file
16
commands/cmd_new.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import os
|
||||
from colorama import Fore
|
||||
|
||||
class NewCommand:
|
||||
def __init__(self, base_dir, filename):
|
||||
if not filename.endswith(".m5r"):
|
||||
filename += ".m5r"
|
||||
self.path = os.path.join(base_dir, filename)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.path):
|
||||
print(Fore.RED + f"Error: {self.path} already exists.")
|
||||
return
|
||||
with open(self.path, "w") as f:
|
||||
f.write("// New m5r file\n")
|
||||
print(Fore.GREEN + f"Created: {self.path}")
|
||||
Reference in New Issue
Block a user