pub struct Registry {
pub harnesses: Vec<HarnessProfile>,
pub runtimes: Vec<RuntimeProfile>,
pub notes: Vec<String>,
}Expand description
All known profiles: the built-ins, overridden or extended by user profile dirs.
Fields§
§harnesses: Vec<HarnessProfile>§runtimes: Vec<RuntimeProfile>§notes: Vec<String>Project profiles (or parts of them) that were skipped, and why.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn load(ctx: &Ctx) -> Result<Registry, Error>
pub fn load(ctx: &Ctx) -> Result<Registry, Error>
Built-ins plus every profile found in profile_dirs.
Sourcepub fn extend_from_project_dir(&mut self, dir: &Path) -> Result<(), Error>
pub fn extend_from_project_dir(&mut self, dir: &Path) -> Result<(), Error>
Add the profiles in a project’s own profile directory. They may add new ids but
not replace a profile hlock already has (put an override in
~/.config/hlock/profiles), and they can’t name a program by path or probe it
with anything but a version flag. What’s skipped is noted in notes.
Sourcepub fn extend_from_dir(&mut self, dir: &Path) -> Result<(), Error>
pub fn extend_from_dir(&mut self, dir: &Path) -> Result<(), Error>
Add (or replace by id) the profiles in dir/harnesses and dir/runtimes.
Sourcepub fn load_for(
ctx: &Ctx,
manifest: Option<&Manifest>,
) -> Result<Registry, Error>
pub fn load_for( ctx: &Ctx, manifest: Option<&Manifest>, ) -> Result<Registry, Error>
Built-ins, profile dirs, then the manifest’s own [harnesses.<id>] tables.
Sourcepub fn add_project_harnesses(&mut self, m: &Manifest) -> Result<(), Error>
pub fn add_project_harnesses(&mut self, m: &Manifest) -> Result<(), Error>
Register a manifest’s [harnesses.<id>] tables as custom profiles. A
table with framework = "<id>" inherits that framework’s packages.
pub fn harness(&self, name: &str) -> Option<&HarnessProfile>
pub fn runtime(&self, name: &str) -> Option<&RuntimeProfile>
Sourcepub fn require_harness(&self, name: &str) -> Result<&HarnessProfile, Error>
pub fn require_harness(&self, name: &str) -> Result<&HarnessProfile, Error>
Look a harness up by id or alias, with a helpful error listing what exists.
Sourcepub fn active(&self, ctx: &Ctx) -> Option<&HarnessProfile>
pub fn active(&self, ctx: &Ctx) -> Option<&HarnessProfile>
The harness this process is running inside, if any.
Sourcepub fn select(
&self,
explicit: Option<&str>,
manifest_target: Option<&str>,
ctx: &Ctx,
) -> Result<Selection, Error>
pub fn select( &self, explicit: Option<&str>, manifest_target: Option<&str>, ctx: &Ctx, ) -> Result<Selection, Error>
Pick the harness a command should target, in precedence order: an explicit
name, HLOCK_HARNESS, the manifest’s [target] harness, the harness this
process runs inside, then the only installed harness.