From 651dbdc5be59017aeca9c2058873fae035816a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=B1?= =?UTF-8?q?=D0=B4=D1=80=D0=B0=D1=85=D0=BC=D0=B0=D0=BD=D0=BE=D0=B2?= <565963@gmail.com> Date: Wed, 9 Oct 2024 17:13:41 +0300 Subject: [PATCH] refactor: parsed to flags, more path --- src/installer.py | 8 ++++---- src/main.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/installer.py b/src/installer.py index 6d854e5..2f2b231 100644 --- a/src/installer.py +++ b/src/installer.py @@ -10,19 +10,19 @@ def install(parsed) -> None: args = parsed.parse_args() if args.install: projectDir = Path(__file__).resolve().parent.parent - homeDir = os.getenv("HOME") - serviceDirExist = os.path.isdir(homeDir + "/.config/systemd/user/") + homeDir = Path(os.getenv("HOME")) + serviceDirExist = os.path.isdir(os.path.join(homeDir, ".config/systemd/user/")) delivered = False if serviceDirExist: delivered = filecmp.cmp( os.path.join(projectDir, "services/wthrc.service"), - homeDir + "/.config/systemd/user/wthrc.service", + os.path.join(homeDir, ".config/systemd/user/wthrc.service"), shallow=True, ) if not delivered or not serviceDirExist: - os.environ["DIR"] = projectDir + os.environ["DIR"] = str(projectDir) subprocess.call(["sh", os.path.join(projectDir, "scripts/install.sh")]) subprocess.call(["sh", os.path.join(projectDir, "scripts/runner.sh")]) diff --git a/src/main.py b/src/main.py index 469be30..4bdeca3 100644 --- a/src/main.py +++ b/src/main.py @@ -1,7 +1,7 @@ from installer import install import argparse -parsed = argparse.ArgumentParser() -parsed.add_argument("--install", "-i", action="store_true") +flags = argparse.ArgumentParser() +flags.add_argument("--install", "-i", action="store_true") -install(parsed) +install(flags)