Skip to main content

install_from_git_subdir

Function install_from_git_subdir 

Source
pub fn install_from_git_subdir(
    url: &str,
    rev: Option<&str>,
    subdir: &str,
    dest_root: &Path,
) -> Result<LoadedManifest, PluginError>
Expand description

Clone a git repository (optionally at rev, a branch or tag) and install the plugin in its subdirectory subdir (for example whatsapp-api in a monorepo with one plugin per directory). Requires the git executable.

subdir must be a relative path inside the repository: absolute paths, .. components and symlinks anywhere along the path are rejected. Only the subdirectory’s contents are installed, after the same manifest, name and checksum checks as install_from_dir.

§Errors

PluginError::Install for an unsafe or missing subdir or a failed clone; any error of install_from_dir for the plugin itself.

§Example

let dest = graphrt_plugin::default_install_dir().unwrap_or_default();
graphrt_plugin::install_from_git_subdir(
    "https://github.com/BimaPangestu28/graphrt-plugins",
    Some("main"),
    "whatsapp-api",
    &dest,
)?;