pub struct Tool {
pub id: Id,
pub manifest: ToolManifest,
pub metadata: ToolMetadataOutput,
pub plugin: PluginContainer<'static>,
pub proto: ProtoEnvironment,
pub version: Option<AliasOrVersion>,
/* private fields */
}Fields§
§id: Id§manifest: ToolManifest§metadata: ToolMetadataOutput§plugin: PluginContainer<'static>§proto: ProtoEnvironment§version: Option<AliasOrVersion>Implementations§
source§impl Tool
impl Tool
pub fn load<I, P>(id: I, proto: P, wasm: Wasm) -> Result<Tool, Report>where I: AsRef<Id>, P: AsRef<ProtoEnvironment>,
pub fn load_from_manifest<I, P>( id: I, proto: P, manifest: Manifest ) -> Result<Tool, Report>where I: AsRef<Id>, P: AsRef<ProtoEnvironment>,
pub fn create_plugin_manifest<P>( proto: P, wasm: Wasm ) -> Result<Manifest, Report>where P: AsRef<ProtoEnvironment>,
sourcepub fn get_bin_path(&self) -> Result<&Path, Report>
pub fn get_bin_path(&self) -> Result<&Path, Report>
Return an absolute path to the executable binary for the tool.
sourcepub fn get_env_var_prefix(&self) -> String
pub fn get_env_var_prefix(&self) -> String
Return the prefix for environment variable names.
sourcepub fn get_globals_bin_dir(&self) -> Option<&Path>
pub fn get_globals_bin_dir(&self) -> Option<&Path>
Return an absolute path to the globals directory in which packages are installed to.
sourcepub fn get_globals_prefix(&self) -> Option<&str>
pub fn get_globals_prefix(&self) -> Option<&str>
Return a string that all globals are prefixed with. Will be used for filtering and listing.
sourcepub fn get_inventory_dir(&self) -> PathBuf
pub fn get_inventory_dir(&self) -> PathBuf
Return an absolute path to the tool’s inventory directory. The inventory houses installed versions, the manifest, and more.
sourcepub fn get_resolved_version(&self) -> AliasOrVersion
pub fn get_resolved_version(&self) -> AliasOrVersion
Return the resolved version or “latest”.
sourcepub fn get_shim_path(&self) -> Option<PathBuf>
pub fn get_shim_path(&self) -> Option<PathBuf>
Return a path to a local shim file if it exists.
sourcepub fn get_temp_dir(&self) -> PathBuf
pub fn get_temp_dir(&self) -> PathBuf
Return an absolute path to a temp directory solely for this tool.
sourcepub fn get_tool_dir(&self) -> PathBuf
pub fn get_tool_dir(&self) -> PathBuf
Return an absolute path to the tool’s install directory for the currently resolved version.
sourcepub fn set_version(&mut self, version: AliasOrVersion)
pub fn set_version(&mut self, version: AliasOrVersion)
Explicitly set the version to use.
sourcepub fn disable_progress_bars(&self) -> bool
pub fn disable_progress_bars(&self) -> bool
Disable progress bars when installing or uninstalling the tool.
source§impl Tool
impl Tool
sourcepub fn create_environment(&self) -> Result<Environment, Report>
pub fn create_environment(&self) -> Result<Environment, Report>
Return environment information to pass to WASM plugin functions.
sourcepub fn register_tool(&mut self) -> Result<(), Report>
pub fn register_tool(&mut self) -> Result<(), Report>
Register the tool by loading initial metadata and persisting it.
sourcepub fn sync_manifest(&mut self) -> Result<(), Report>
pub fn sync_manifest(&mut self) -> Result<(), Report>
Sync the local tool manifest with changes from the plugin.
source§impl Tool
impl Tool
sourcepub async fn load_version_resolver(
&self,
initial_version: &VersionType
) -> impl Future<Output = Result<VersionResolver<'_>, Report>>
pub async fn load_version_resolver( &self, initial_version: &VersionType ) -> impl Future<Output = Result<VersionResolver<'_>, Report>>
Load available versions to install and return a resolver instance. To reduce network overhead, results will be cached for 24 hours.
sourcepub async fn resolve_version(
&mut self,
initial_version: &VersionType
) -> impl Future<Output = Result<(), Report>>
pub async fn resolve_version( &mut self, initial_version: &VersionType ) -> impl Future<Output = Result<(), Report>>
Given an initial version, resolve it to a fully qualifed and semantic version (or alias) according to the tool’s ecosystem.
source§impl Tool
impl Tool
sourcepub async fn detect_version_from(
&self,
current_dir: &Path
) -> impl Future<Output = Result<Option<VersionType>, Report>>
pub async fn detect_version_from( &self, current_dir: &Path ) -> impl Future<Output = Result<Option<VersionType>, Report>>
Attempt to detect an applicable version from the provided directory.
source§impl Tool
impl Tool
sourcepub async fn verify_checksum(
&self,
checksum_file: &Path,
download_file: &Path
) -> impl Future<Output = Result<bool, Report>>
pub async fn verify_checksum( &self, checksum_file: &Path, download_file: &Path ) -> impl Future<Output = Result<bool, Report>>
Verify the downloaded file using the checksum strategy for the tool. Common strategies are SHA256 and MD5.
sourcepub async fn install_from_prebuilt(
&self,
install_dir: &Path
) -> impl Future<Output = Result<PathBuf, Report>>
pub async fn install_from_prebuilt( &self, install_dir: &Path ) -> impl Future<Output = Result<PathBuf, Report>>
Download the tool (as an archive) from its distribution registry
into the ~/.proto/temp folder, and optionally verify checksums.
sourcepub async fn install(&mut self) -> impl Future<Output = Result<bool, Report>>
pub async fn install(&mut self) -> impl Future<Output = Result<bool, Report>>
Install a tool into proto, either by downloading and unpacking a pre-built archive, or by using a native installation method.
sourcepub async fn uninstall(&self) -> impl Future<Output = Result<bool, Report>>
pub async fn uninstall(&self) -> impl Future<Output = Result<bool, Report>>
Uninstall the tool by deleting the current install directory.
source§impl Tool
impl Tool
sourcepub fn create_shim_context(&self) -> ShimContext<'_>
pub fn create_shim_context(&self) -> ShimContext<'_>
Create the context object required for creating shim files.
source§impl Tool
impl Tool
sourcepub async fn is_setup(
&mut self,
initial_version: &VersionType
) -> impl Future<Output = Result<bool, Report>>
pub async fn is_setup( &mut self, initial_version: &VersionType ) -> impl Future<Output = Result<bool, Report>>
Return true if the tool has been setup (installed and binaries are located).
sourcepub async fn setup(
&mut self,
initial_version: &VersionType
) -> impl Future<Output = Result<bool, Report>>
pub async fn setup( &mut self, initial_version: &VersionType ) -> impl Future<Output = Result<bool, Report>>
Setup the tool by resolving a semantic version, installing the tool, locating binaries, creating shims, and more.
sourcepub async fn setup_shims(
&mut self,
force: bool
) -> impl Future<Output = Result<(), Report>>
pub async fn setup_shims( &mut self, force: bool ) -> impl Future<Output = Result<(), Report>>
Setup shims if they are missing or out of date.
Auto Trait Implementations§
impl !RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl !UnwindSafe for Tool
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<I, T> ExtractContext<I, ()> for T
impl<I, T> ExtractContext<I, ()> for T
§fn extract_context(self, _original_input: I)
fn extract_context(self, _original_input: I)
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where T: AsFilelike,
self file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where T: AsFilelike,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more