mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-06 07:19:29 -05:00
ci: add flake update workflow
Also add contributing, funding and issue templates parser: add kill option to shell version: fix errors when not on arch
This commit is contained in:
@@ -22,6 +22,7 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
|
||||
shell_parser.add_argument("-d", "--daemon", action="store_true", help="start the shell detached")
|
||||
shell_parser.add_argument("-s", "--show", action="store_true", help="print all shell IPC commands")
|
||||
shell_parser.add_argument("-l", "--log", action="store_true", help="print the shell log")
|
||||
shell_parser.add_argument("-k", "--kill", action="store_true", help="kill the shell")
|
||||
shell_parser.add_argument("--log-rules", metavar="RULES", help="log rules to apply")
|
||||
|
||||
# Create parser for toggle opts
|
||||
|
||||
@@ -17,6 +17,9 @@ class Command:
|
||||
elif self.args.log:
|
||||
# Print the log
|
||||
self.print_log()
|
||||
elif self.args.kill:
|
||||
# Kill the shell
|
||||
self.shell("kill")
|
||||
elif self.args.message:
|
||||
# Send a message
|
||||
self.message(*self.args.message)
|
||||
|
||||
@@ -1,30 +1,42 @@
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from caelestia.utils.paths import config_dir
|
||||
|
||||
|
||||
def print_version() -> None:
|
||||
print("Packages:")
|
||||
pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
|
||||
versions = subprocess.run(
|
||||
["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
|
||||
).stdout
|
||||
if shutil.which("pacman"):
|
||||
print("Packages:")
|
||||
pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"]
|
||||
versions = subprocess.run(
|
||||
["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True
|
||||
).stdout
|
||||
|
||||
for pkg in pkgs:
|
||||
if pkg not in versions:
|
||||
print(f" {pkg} not installed")
|
||||
print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
|
||||
for pkg in pkgs:
|
||||
if pkg not in versions:
|
||||
print(f" {pkg} not installed")
|
||||
print("\n".join(f" {pkg}" for pkg in versions.splitlines()))
|
||||
else:
|
||||
print("Packages: not on Arch")
|
||||
|
||||
caelestia_dir = (config_dir / "hypr").resolve().parent
|
||||
print("\nCaelestia:")
|
||||
caelestia_ver = subprocess.check_output(
|
||||
["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
|
||||
)
|
||||
print(" Last commit:", caelestia_ver.split()[1])
|
||||
print(" Commit message:", *caelestia_ver.splitlines()[1:])
|
||||
print()
|
||||
try:
|
||||
caelestia_dir = (config_dir / "hypr").resolve().parent
|
||||
caelestia_ver = subprocess.check_output(
|
||||
["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True
|
||||
)
|
||||
print("Caelestia:")
|
||||
print(" Last commit:", caelestia_ver.split()[1])
|
||||
print(" Commit message:", *caelestia_ver.splitlines()[1:])
|
||||
except subprocess.CalledProcessError:
|
||||
print("Caelestia: not installed")
|
||||
|
||||
print("\nQuickshell:")
|
||||
print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
|
||||
print()
|
||||
if shutil.which("qs"):
|
||||
print("Quickshell:")
|
||||
print(" ", subprocess.check_output(["qs", "--version"], text=True).strip())
|
||||
else:
|
||||
print("Quickshell: not in PATH")
|
||||
|
||||
local_shell_dir = config_dir / "quickshell/caelestia"
|
||||
if local_shell_dir.exists():
|
||||
|
||||
Reference in New Issue
Block a user