Remove useless intermediary struct
This commit is contained in:
@ -18,33 +18,18 @@ enum UpdateSteps {
|
||||
pub struct Updater {
|
||||
systems: Vec<System>,
|
||||
steps: UpdateSteps,
|
||||
nice: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct System {
|
||||
fetch: Option<Fetch>,
|
||||
compile: Option<Compile>,
|
||||
install: Install,
|
||||
//name: String,
|
||||
fetch: Option<Cmd>,
|
||||
compile: Option<Cmd>,
|
||||
install: Cmd,
|
||||
// deps or rDeps : Tree
|
||||
// exclusive_with : List
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Fetch {
|
||||
command: Cmd,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Compile {
|
||||
command: Cmd,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Install {
|
||||
command: Cmd,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct Cmd {
|
||||
exe: String,
|
||||
@ -58,14 +43,11 @@ impl Updater {
|
||||
let mut up = Updater {
|
||||
systems: vec![],
|
||||
steps: UpdateSteps::Fetch,
|
||||
nice: None,
|
||||
};
|
||||
up.systems.push(System {
|
||||
fetch: None,
|
||||
compile: None,
|
||||
install: Install {
|
||||
command: Cmd::new(),
|
||||
},
|
||||
install: Cmd::new(),
|
||||
});
|
||||
up
|
||||
}
|
||||
@ -134,20 +116,20 @@ impl Updater {
|
||||
impl System {
|
||||
pub fn fetch(&self) -> Result<()> {
|
||||
if let Some(fetch) = &self.fetch {
|
||||
fetch.command.execute()?;
|
||||
fetch.execute()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn compile(&self) -> Result<()> {
|
||||
if let Some(compile) = &self.compile {
|
||||
compile.command.execute()?;
|
||||
compile.execute()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn install(&self) -> Result<()> {
|
||||
self.install.command.execute()?;
|
||||
self.install.execute()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user