pub struct CommandContext {
pub manifest: Manifest,
pub manifest_path: PathBuf,
pub project_dir: PathBuf,
pub lockfile_path: PathBuf,
}Expand description
Common context for CLI commands that need manifest and project information
Fields§
§manifest: ManifestParsed project manifest (agpm.toml)
manifest_path: PathBufPath to the manifest file
project_dir: PathBufProject root directory (containing agpm.toml)
lockfile_path: PathBufPath to the lockfile (agpm.lock)
Implementations§
Source§impl CommandContext
impl CommandContext
Sourcepub fn from_manifest_path(manifest_path: impl AsRef<Path>) -> Result<Self>
pub fn from_manifest_path(manifest_path: impl AsRef<Path>) -> Result<Self>
Create a new command context from a manifest path
Sourcepub fn load_lockfile(&self) -> Result<Option<LockFile>>
pub fn load_lockfile(&self) -> Result<Option<LockFile>>
Load an existing lockfile if it exists
Sourcepub fn save_lockfile(&self, lockfile: &LockFile) -> Result<()>
pub fn save_lockfile(&self, lockfile: &LockFile) -> Result<()>
Save a lockfile to the project directory
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandContext
impl RefUnwindSafe for CommandContext
impl Send for CommandContext
impl Sync for CommandContext
impl Unpin for CommandContext
impl UnwindSafe for CommandContext
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
Mutably borrows from an owned value. Read more