mirror of
https://github.com/m4rcel-lol/m5rcode-ubuntu.git
synced 2025-12-06 19:13:57 +05:30
16 lines
517 B
Python
16 lines
517 B
Python
import os, subprocess
|
|
from colorama import Fore
|
|
|
|
class NanoCommand:
|
|
def __init__(self, base_dir, filename):
|
|
if not filename.endswith(".m5r"):
|
|
filename += ".m5r"
|
|
self.path = os.path.join(base_dir, filename)
|
|
|
|
def run(self):
|
|
editor = os.getenv("EDITOR", "notepad")
|
|
if not os.path.exists(self.path):
|
|
print(Fore.YELLOW + f"Note: {self.path} does not exist, creating it.")
|
|
open(self.path, "w").close()
|
|
subprocess.call([editor, self.path])
|