pub fn install_package(
package_file: &Path,
scope_override: Option<Scope>,
registry_handle: &str,
yes: bool,
sub_packages: Option<Vec<String>>,
) -> Result<Vec<String>>Expand description
Installs a Zoi package from a local package archive.
This function unpacks a .pkg.tar.zst archive and installs its contents
into the appropriate Zoi store, linking any binaries.
§Arguments
package_file: Path to the local package archive.scope_override: Optionally override the installation scope (User,System,Project).registry_handle: The handle of the registry this package belongs to (e.g. “zoidberg”, or “local”).yes: Automatically answer “yes” to any confirmation prompts (e.g. file conflicts).sub_packages: For split packages, optionally specify which sub-packages to install.
§Returns
A Result containing a Vec<String> of all the file paths that were installed.
§Errors
Returns an error if the installation fails, such as if the archive is invalid or if there are file system permission issues.
§Examples
use zoi::{install_package, Scope};
use std::path::Path;
use anyhow::Result;
fn main() -> Result<()> {
let archive_path = Path::new("my-package-1.0.0-linux-amd64.pkg.tar.zst");
install_package(archive_path, Some(Scope::User), "local", true, None)?;
println!("Package installed!");
Ok(())
}