refactor: parsed to flags, more path
This commit is contained in:
parent
f1d6e154f9
commit
651dbdc5be
|
@ -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")])
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user