Skip to main content

App

Struct App 

Source
pub struct App { /* private fields */ }
Expand description

Top-level application orchestrator.

Implementations§

Source§

impl App

Source

pub fn from_env() -> Result<Self, CoreError>

Creates an application from the process environment.

Source

pub fn new( home_layout: HomeLayout, cwd: PathBuf, session_id: Option<String>, ) -> Result<Self, CoreError>

Creates an application with explicit paths.

Source§

impl App

Source

pub fn activate(&self, shell: &str) -> Result<String, CoreError>

Renders an activation script for the selected shell.

Source§

impl App

Source

pub fn add_plugin( &self, name: Option<&str>, source: Option<String>, backend: Option<PluginBackendKind>, alias: Option<&str>, ) -> Result<RegistryEntry, CoreError>

Adds a plugin to the local home.

Source§

impl App

Source

pub fn available_plugins(&self) -> Result<Vec<RegistryEntry>, CoreError>

Lists plugins in the available registry index.

Source

pub fn added_plugins(&self) -> Result<Vec<RegistryEntry>, CoreError>

Lists plugins added to the local home.

Source§

impl App

Source

pub fn home_dir(&self) -> String

Returns the active home directory path.

Source

pub fn cd_path(&self, plugin_name: &str) -> Result<String, CoreError>

Prints the active runtime directory for a tool.

Source

pub fn plugin_dir(&self, plugin_name: &str) -> Result<String, CoreError>

Returns the local plugin source directory.

Source§

impl App

Source

pub fn cleanup_session(&self) -> Result<(), CoreError>

Removes the session tools file for the current session.

Called by the shell EXIT trap via vs __cleanup-session so that the home directory is resolved at runtime rather than hardcoded in the activation script.

Source

pub fn cleanup_stale_sessions(&self) -> Result<(), CoreError>

Removes session files for processes that no longer exist.

Called during activation for shells that lack an EXIT trap (nushell, clink) via vs __cleanup-stale-sessions.

Source§

impl App

Source

pub fn list_config(&self) -> Result<Vec<(String, String)>, CoreError>

Lists current application config values.

Source

pub fn config_value(&self) -> Result<Value, CoreError>

Returns the whole config as a YAML-like value.

Source

pub fn config_entries_for_key( &self, key: &str, ) -> Result<Vec<(String, String)>, CoreError>

Returns config entries for an exact key or section prefix.

Source

pub fn set_config_value(&self, key: &str, value: &str) -> Result<(), CoreError>

Sets a config key.

Source

pub fn unset_config_value(&self, key: &str) -> Result<(), CoreError>

Unsets a config key.

Source§

impl App

Source

pub fn current_tool( &self, plugin_name: &str, ) -> Result<Option<CurrentTool>, CoreError>

Resolves the active version for a specific plugin.

Source

pub fn current_tools(&self) -> Result<Vec<CurrentTool>, CoreError>

Resolves all active tools for the current context.

Source

pub fn current_tool_statuses( &self, ) -> Result<Vec<(String, Option<String>)>, CoreError>

Returns all known plugins with their current version when available.

Source§

impl App

Source

pub fn exec( &self, plugin_name: &str, requested_version: Option<&str>, command: &str, args: &[String], ) -> Result<i32, CoreError>

Executes a command with the resolved runtime environment for a specific SDK.

Source§

impl App

Source

pub fn hook_env(&self, shell: &str) -> Result<String, CoreError>

Renders hidden shell hook output.

Source§

impl App

Source

pub fn plugin_info(&self, name: &str) -> Result<PluginInfo, CoreError>

Loads registry and backend metadata for a plugin.

Source

pub fn plugin_runtime_path( &self, plugin_name: &str, version: &str, ) -> Result<Option<PathBuf>, CoreError>

Returns the installed runtime path for a specific plugin version.

Source§

impl App

Source

pub fn install_plugin_version( &self, plugin_name: &str, version: Option<&str>, ) -> Result<InstalledVersion, CoreError>

Installs a plugin version, choosing the first available version when omitted.

Source

pub fn project_tool_version( &self, plugin_name: &str, ) -> Result<Option<String>, CoreError>

Returns the version requested by the project config for a plugin, when present.

Source

pub fn configured_tools_for_install( &self, ) -> Result<Vec<(String, String)>, CoreError>

Lists configured tools that should be installed for the current context.

Source§

impl App

Source

pub fn list_installed_versions( &self, ) -> Result<Vec<InstalledVersion>, CoreError>

Lists installed tool versions in the local cache.

Source§

impl App

Source

pub fn migrate( &self, source: Option<String>, ) -> Result<MigrateSummary, CoreError>

Copies compatible state from a legacy home into the active home.

Source§

impl App

Source

pub fn remove_plugin(&self, name: &str) -> Result<bool, CoreError>

Removes a plugin, its source directory, and all installed SDK versions.

Source§

impl App

Source

pub fn search_versions( &self, plugin_name: &str, args: &[String], ) -> Result<Vec<AvailableVersion>, CoreError>

Lists available SDK versions for a plugin.

Source§

impl App

Source

pub fn uninstall_plugin_version( &self, plugin_name: &str, version: &str, ) -> Result<UninstallResult, CoreError>

Uninstalls a plugin version from the local cache.

When the uninstalled version is currently active and other versions remain, auto-switches to the first remaining version (global scope). When no versions remain, removes the entire plugin cache directory.

Source§

impl App

Source

pub fn unuse_tool( &self, plugin_name: &str, scope: UseScope, ) -> Result<(), CoreError>

Removes an active tool version from the selected scope.

Source§

impl App

Source

pub fn update_registry(&self) -> Result<usize, CoreError>

Refreshes the searchable plugin index from the configured registry source.

Source

pub fn update_plugin(&self, name: &str) -> Result<RegistryEntry, CoreError>

Updates a locally added plugin from its manifest URL or registry metadata.

Source

pub fn update_all_plugins(&self) -> Result<Vec<RegistryEntry>, CoreError>

Updates every locally added plugin.

Source§

impl App

Source

pub fn self_upgrade_summary(&self) -> Result<SelfUpgradeSummary, CoreError>

Returns the current and latest available self-upgrade versions.

Source

pub fn upgrade_self_to( &self, latest_version: &str, ) -> Result<SelfUpgradeSummary, CoreError>

Upgrades the running vs binary to the provided published release version.

Source§

impl App

Source

pub fn use_tool( &self, plugin_name: &str, version: &str, scope: UseScope, unlink: bool, ) -> Result<InstalledVersion, CoreError>

Activates an installed tool version for a given scope.

Source

pub fn project_tool_version_for_use( &self, plugin_name: &str, ) -> Result<Option<String>, CoreError>

Resolves the version from the project config file when no version is specified on the CLI (empty string). Returns None when no project config is found.

Source

pub fn installed_versions_for_plugin( &self, plugin_name: &str, ) -> Result<Vec<InstalledVersion>, CoreError>

Returns installed versions for a single plugin, sorted from newest-looking to oldest-looking.

Source§

impl App

Source

pub fn version_info(&self) -> Result<VersionInfo, CoreError>

Returns version and build metadata for the current binary.

Trait Implementations§

Source§

impl Clone for App

Source§

fn clone(&self) -> App

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for App

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for App

§

impl RefUnwindSafe for App

§

impl Send for App

§

impl Sync for App

§

impl Unpin for App

§

impl UnsafeUnpin for App

§

impl UnwindSafe for App

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T