From 4f97e1efc3a47ad230e9270703b538b1f5d79aec 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: Mon, 7 Oct 2024 10:03:55 +0300 Subject: [PATCH] fix: add args input use --install from now onward --- src/installer.py | 24 ++++++++++++++++-------- src/main.py | 8 +++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/installer.py b/src/installer.py index 27fe690..97fceb1 100644 --- a/src/installer.py +++ b/src/installer.py @@ -2,13 +2,21 @@ import filecmp import subprocess import os from time import sleep +from server import weather_run -def install(): - projectDir="/home/citrullux/ModernOSLabs" - delivered=filecmp.cmp(projectDir+"/services/wthrc.service", "/home/citrullux/.config/systemd/user/wthrc.service", shallow=True) - if not delivered: - os.environ["DIR"]=projectDir - subprocess.call(["/usr/bin/sh", projectDir+"/scripts/install.sh"]) - subprocess.call(["/usr/bin/sh", projectDir+"/scripts/runner.sh"]) - sleep(5) +def install(parsed): + args = parsed.parse_args() + if args.install: + projectDir = "/home/citrullux/ModernOSLabs" + delivered = filecmp.cmp( + projectDir + "/services/wthrc.service", + "/home/citrullux/.config/systemd/user/wthrc.service", + shallow=True, + ) + if not delivered: + os.environ["DIR"] = projectDir + subprocess.call(["/usr/bin/sh", projectDir + "/scripts/install.sh"]) + subprocess.call(["/usr/bin/sh", projectDir + "/scripts/runner.sh"]) + sleep(5) + weather_run() diff --git a/src/main.py b/src/main.py index 9c79418..469be30 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,7 @@ -from server import weather_run from installer import install +import argparse -install() -weather_run() +parsed = argparse.ArgumentParser() +parsed.add_argument("--install", "-i", action="store_true") + +install(parsed)