Trait amisgitpm::pm::PMInteractive
source · pub trait PMInteractive: PMProgrammatic {
fn i_install<T: AsRef<str>>(&mut self, url: T) -> Result<(), Self::Error>;
fn i_list<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>;
fn i_edit<T: AsRef<str>>(&mut self, project: T) -> Result<(), Self::Error>;
fn i_update<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>;
fn i_restore<T: AsRef<str>, Q: AsRef<[T]>>(
self,
prj_names: Q
) -> Result<(), Self::Error>;
fn i_uninstall<T: AsRef<str>, Q: AsRef<[T]>>(
&mut self,
prj_names: Q
) -> Result<(), Self::Error>;
}
Expand description
This trait defines methods for the six tasks to be interactive, it provides none of the methods, as different implementors will bring different preferences for dependencies and ways of interacting with the user.
Required Methods§
sourcefn i_install<T: AsRef<str>>(&mut self, url: T) -> Result<(), Self::Error>
fn i_install<T: AsRef<str>>(&mut self, url: T) -> Result<(), Self::Error>
With this function a project should be downloaded, ask for the necessary information and then build and install itself The contents could look something like:
ⓘ
let project : Project{
directory : somehow_get_directory()
url: url
..Default::default()
};
let (repo, git_dir) = self.download(&project)?;
let project = somehow_get_rest_of project()?;
self.switch_branch(&project, &repo)?;
self.get_mut_store()
.add(project.clone())
.map_err(Self::map_store_error)?;
self.mv(&project, &git_dir)?;
self.build(&project)?;
Ok(())
sourcefn i_list<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>
fn i_list<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>
This function should give the available information of the projects If the list is empty it’s suggested to print all the projects information
sourcefn i_edit<T: AsRef<str>>(&mut self, project: T) -> Result<(), Self::Error>
fn i_edit<T: AsRef<str>>(&mut self, project: T) -> Result<(), Self::Error>
Edit a projects information and store that
sourcefn i_update<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>
fn i_update<T: AsRef<str>, Q: AsRef<[T]>>(
&self,
prj_names: Q
) -> Result<(), Self::Error>
Update the projects, (Possibly a forwarding of the PMBasics
update
method applied to each of the projects)