shell: add restart command, fix call None arg, add tests

This commit is contained in:
2026-05-22 22:38:35 +02:00
parent 67ae693d0c
commit 5f92b6f6de
4 changed files with 98 additions and 30 deletions
-13
View File
@@ -1,13 +0,0 @@
# import json
# import typer
# from zshell.assets.schemes.catppuccin import catppuccin
#
# app = typer.Typer()
#
# SCHEMES = catppuccin.variants.flavors
#
#
# @app.command()
# def set():
# TODO: Currently unsused
-16
View File
@@ -1,16 +0,0 @@
# import typer
# import subprocess
#
# from typing import Optional
#
# app = typer.Typer()
#
# RECORDER = "gpu-screen-recorder"
# HOME = str(os.getenv("HOME"))
# CONFIG = Path(HOME + "/.config/zshell/config.json")
#
#
# @app.command()
# def start():
# TODO: Currently unused
+7 -1
View File
@@ -16,6 +16,12 @@ def start(no_daemon: bool = False):
subprocess.run(args + ["-n"] + ([] if no_daemon else ["-d"]), check=True)
@app.command()
def restart(no_daemon: bool = False):
subprocess.run(args + ["kill"], check=False)
subprocess.run(args + ["-n"] + ([] if no_daemon else ["-d"]), check=True)
@app.command()
def show():
subprocess.run(args + ["ipc"] + ["show"], check=True)
@@ -33,4 +39,4 @@ def lock():
@app.command()
def call(target: str, method: str, method_args: list[str] = typer.Argument(None)):
subprocess.run(args + ["ipc"] + ["call"] + [target] + [method] + method_args, check=True)
subprocess.run(args + ["ipc"] + ["call"] + [target] + [method] + (method_args or []), check=True)