diff --git a/soypak/cli/commands/install.py b/soypak/cli/commands/install.py new file mode 100644 index 0000000..28e4cd9 --- /dev/null +++ b/soypak/cli/commands/install.py @@ -0,0 +1,43 @@ +import clog +import pathlib +import argparse +import soypak.cli.command as command +import soypak.deps.transaction as transaction # :@Note: future use +import soypak.deps.bottler as bottler + + +_log = clog.Logger.get("runtime_logger") + + +@command.register_command(name="install", help=command.CommandHelpStruct( + synopsis="Install debian binary packages.", + usage="install [, ..., ]", + summary=("Install one or multiple available packages via soypak.")) +) +class Install(command.Command): + def __init__(self, *, data: argparse.Namespace, args: list[str] = []) -> None: + super().__init__() + self.data = data + self.rargs = args + + + def run(self): + candidates: list[bottler.Soybottle] = [] + # any preinit before installing should occur here + for item in self.rargs: + # has a Debian file been directly passed? + if item.endswith(".bottle") and pathlib.Path(item).resolve().exists(): + _log.debug("Detected a bottle file. Considering sidingloading...") + # let's structure the file to be processed. + pkg = bottler.loadPackage(item) + if pkg is None: + # :@Ethan: maybe the loadPackage could give us some information. + raise Exception(f"Unable to load {item}.") + _log.debug(f"Sideloading: {item}").withConsole() + candidates.append(pkg) + + continue + # let's check the database for a package by the given name + ... + +