File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,5 +166,17 @@ def setup(dry_run, force):
166166 sys .exit (1 )
167167
168168
169+ @cli .command ()
170+ def editor ():
171+ """Launch concore-editor"""
172+ try :
173+ from .commands .editor import launch_editor
174+
175+ launch_editor ()
176+ except Exception as e :
177+ console .print (f"[red]Error:[/red] { str (e )} " )
178+ sys .exit (1 )
179+
180+
169181if __name__ == "__main__" :
170182 cli ()
Original file line number Diff line number Diff line change 1+ import os
2+ import sys
3+ import shutil
4+ import subprocess
5+ from rich .console import Console
6+
7+ console = Console ()
8+ EDITOR_URL = "https://controlcore-project.github.io/concore-editor/"
9+
10+
11+ def open_editor_url (url ):
12+ try :
13+ if sys .platform == "win32" :
14+ os .system (f'start "" chrome "{ url } "' )
15+ else :
16+ if shutil .which ("open" ):
17+ if sys .platform == "darwin" :
18+ subprocess .run (["open" , "-a" , "Google Chrome" , url ])
19+ elif sys .platform .startswith ("linux" ):
20+ subprocess .run (["xdg-open" , url ])
21+ else :
22+ if shutil .which ("xdg-open" ):
23+ subprocess .run (["xdg-open" , url ])
24+ else :
25+ console .print ("unable to open browser for the concore editor." )
26+ except Exception as e :
27+ console .print (f"unable to open browser for the concore editor. ({ e } )" )
28+
29+
30+ def launch_editor ():
31+ console .print ("[cyan]Opening concore-editor...[/cyan]" )
32+ open_editor_url (EDITOR_URL )
You can’t perform that action at this time.
0 commit comments