Skip to content

Commit 34035af

Browse files
author
PyCompiler ARK++
committed
feat: Add Click-based CLI for launching BCASL Studio with standalone option
1 parent a6c7843 commit 34035af

1 file changed

Lines changed: 37 additions & 3 deletions

File tree

main.py

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,41 @@ def _launch_main():
451451
return 1
452452

453453

454+
# Click-based CLI to allow launching BCASL-only Studio from the root entry
455+
try:
456+
import click
457+
458+
@click.group(invoke_without_command=True, context_settings={"help_option_names": ["-h", "--help"]})
459+
@click.option("--bcasl-only", is_flag=True, help="Launch BCASL Studio (Standalone)")
460+
@click.pass_context
461+
def cli(ctx: click.Context, bcasl_only: bool):
462+
"""PyCompiler ARK++ CLI."""
463+
if ctx.invoked_subcommand is None:
464+
if bcasl_only:
465+
from bcasl.only_mod.app import run as run_bcasl
466+
rc = run_bcasl(sys.argv)
467+
raise SystemExit(rc)
468+
else:
469+
rc = main(sys.argv)
470+
raise SystemExit(rc)
471+
472+
@cli.command(name="bcasl")
473+
def cli_bcasl():
474+
"""Launch BCASL Studio (Standalone)."""
475+
from bcasl.only_mod.app import run as run_bcasl
476+
rc = run_bcasl(sys.argv)
477+
raise SystemExit(rc)
478+
479+
except Exception:
480+
# Fallback CLI if click isn't available
481+
def cli(): # type: ignore
482+
if any(arg in ("--bcasl-only", "bcasl") for arg in sys.argv[1:]):
483+
from bcasl.only_mod.app import run as run_bcasl
484+
rc = run_bcasl(sys.argv)
485+
raise SystemExit(rc)
486+
rc = main(sys.argv)
487+
raise SystemExit(rc)
488+
489+
454490
if __name__ == "__main__":
455-
import multiprocessing
456-
multiprocessing.set_start_method("spawn", force=True)
457-
sys.exit(main(sys.argv))
491+
cli()

0 commit comments

Comments
 (0)