Make the linux upgrade function a method
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -108,13 +108,23 @@ fn run() -> Result<(), Error> {
|
||||
&mut terminal,
|
||||
));
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
let distribution = linux::Distribution::detect();
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
if !opt.no_system {
|
||||
report.push_result(execute(
|
||||
|terminal| linux::upgrade(&sudo, terminal, opt.dry_run),
|
||||
&mut terminal,
|
||||
));
|
||||
match distribution {
|
||||
Ok(distribution) => {
|
||||
report.push_result(execute(
|
||||
|terminal| distribution.upgrade(&sudo, terminal, opt.dry_run),
|
||||
&mut terminal,
|
||||
));
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Error detecting current distribution: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user