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
15
commands/cmd_nano.py
Normal file
15
commands/cmd_nano.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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])
|
||||
Reference in New Issue
Block a user