From 785b58c117b13d0793d13420ce7408f25055aa91 Mon Sep 17 00:00:00 2001 From: GREENRAT-K405 Date: Fri, 27 Mar 2026 06:27:08 +0530 Subject: [PATCH 1/2] Add concore editor to CLI --- concore_cli/cli.py | 11 +++++++++++ concore_cli/commands/editor.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 concore_cli/commands/editor.py diff --git a/concore_cli/cli.py b/concore_cli/cli.py index 90cf112..9227838 100644 --- a/concore_cli/cli.py +++ b/concore_cli/cli.py @@ -166,5 +166,16 @@ def setup(dry_run, force): sys.exit(1) +@cli.command() +def editor(): + """Launch concore-editor""" + try: + from .commands.editor import launch_editor + launch_editor() + except Exception as e: + console.print(f"[red]Error:[/red] {str(e)}") + sys.exit(1) + + if __name__ == "__main__": cli() diff --git a/concore_cli/commands/editor.py b/concore_cli/commands/editor.py new file mode 100644 index 0000000..5ad8562 --- /dev/null +++ b/concore_cli/commands/editor.py @@ -0,0 +1,33 @@ +import click +import os +import sys +import shutil +import subprocess +import urllib.parse +from pathlib import Path +from rich.console import Console + +console = Console() +EDITOR_URL = "https://controlcore-project.github.io/concore-editor/" + +def open_editor_url(url): + try: + if sys.platform == "win32": + os.system(f'start "" chrome "{url}"') + else: + if shutil.which("open"): + if sys.platform == "darwin": + subprocess.run(["open", "-a", "Google Chrome", url]) + elif sys.platform.startswith("linux"): + subprocess.run(["xdg-open", url]) + else: + if shutil.which("xdg-open"): + subprocess.run(["xdg-open", url]) + else: + console.print("unable to open browser for the concore editor.") + except Exception as e: + console.print(f"unable to open browser for the concore editor. ({e})") + +def launch_editor(): + console.print("[cyan]Opening concore-editor...[/cyan]") + open_editor_url(EDITOR_URL) From 98e1a6feeb4d106e9bc0312d970c1c0b82590c0b Mon Sep 17 00:00:00 2001 From: GREENRAT-K405 Date: Fri, 27 Mar 2026 06:31:06 +0530 Subject: [PATCH 2/2] Add concore editor to CLI --- concore_cli/cli.py | 1 + concore_cli/commands/editor.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/concore_cli/cli.py b/concore_cli/cli.py index 9227838..32061c0 100644 --- a/concore_cli/cli.py +++ b/concore_cli/cli.py @@ -171,6 +171,7 @@ def editor(): """Launch concore-editor""" try: from .commands.editor import launch_editor + launch_editor() except Exception as e: console.print(f"[red]Error:[/red] {str(e)}") diff --git a/concore_cli/commands/editor.py b/concore_cli/commands/editor.py index 5ad8562..b40962d 100644 --- a/concore_cli/commands/editor.py +++ b/concore_cli/commands/editor.py @@ -1,15 +1,13 @@ -import click import os import sys import shutil import subprocess -import urllib.parse -from pathlib import Path from rich.console import Console console = Console() EDITOR_URL = "https://controlcore-project.github.io/concore-editor/" + def open_editor_url(url): try: if sys.platform == "win32": @@ -28,6 +26,7 @@ def open_editor_url(url): except Exception as e: console.print(f"unable to open browser for the concore editor. ({e})") + def launch_editor(): console.print("[cyan]Opening concore-editor...[/cyan]") open_editor_url(EDITOR_URL)