Add first install arg

This commit is contained in:
flyingscorpio@arch-desktop 2020-05-30 14:35:37 +02:00
parent 81fbb879ce
commit 420b1d9498

View file

@ -18,13 +18,16 @@ from ruamel.yaml import YAML # type: ignore
class Installer:
"""Regroups all the installation methods listed in the yaml conf file."""
def __init__(self, force: bool = False, update: bool = False):
def __init__(
self, force: bool = False, first_install: bool = False, update: bool = False
):
yaml = YAML(typ="safe")
self.conf = yaml.load(Path("configs.yml").text())
self.base_dir = Path.getcwd()
self.home = Path("~").expanduser()
self.operating_system = define_os()
self.force = force
self.first_install = first_install
self.update = update
def evaluate_condition(self, condition: str) -> bool:
@ -35,6 +38,8 @@ class Installer:
"debian": self.operating_system == "debian based",
"force": self.force,
"no force": not self.force,
"first install": self.first_install,
"no first install": not self.first_install,
"update": self.update,
"no update": not self.update,
}
@ -371,6 +376,12 @@ def main() -> None:
parser.add_argument(
"-F", "--force", action="store_true", help="Overwrite existing files",
)
parser.add_argument(
"-i",
"--first_install",
action="store_true",
help="Assume the program is not installed",
)
parser.add_argument(
"-g",
"--generate",
@ -392,11 +403,12 @@ def main() -> None:
programs = args.programs
from_file = args.from_file
force = args.force
first_install = args.first_install
generate = args.generate
list_programs = args.list_programs
update = args.update
installer = Installer(force=force, update=update)
installer = Installer(force=force, first_install=first_install, update=update)
if generate:
installer.generate_process_list()