mirror of
https://github.com/m4rcel-lol/m5rcode.git
synced 2025-12-07 03:23:57 +05:30
17 lines
503 B
Python
17 lines
503 B
Python
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}")
|