Ran a linter to improve code
This commit is contained in:
parent
b06fc99e9e
commit
27b87f7da2
@ -26,7 +26,7 @@ impl Config {
|
|||||||
let mut prog = match get {
|
let mut prog = match get {
|
||||||
None => {
|
None => {
|
||||||
println!("Sorry, your package manager does not support this action");
|
println!("Sorry, your package manager does not support this action");
|
||||||
std::process::exit(0);
|
std::process::exit(0)
|
||||||
},
|
},
|
||||||
Some(vec) => vec,
|
Some(vec) => vec,
|
||||||
};
|
};
|
||||||
@ -41,7 +41,7 @@ impl Config {
|
|||||||
child.wait().expect("Failed to wait on package manager");
|
child.wait().expect("Failed to wait on package manager");
|
||||||
},
|
},
|
||||||
(_, &None) => {
|
(_, &None) => {
|
||||||
for arg in prog.iter() {
|
for arg in &prog {
|
||||||
let mut child =Command::new(&command)
|
let mut child =Command::new(&command)
|
||||||
.arg(arg)
|
.arg(arg)
|
||||||
.spawn()
|
.spawn()
|
||||||
@ -50,7 +50,7 @@ impl Config {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(Some(_), &Some(ref term)) => {
|
(Some(_), &Some(ref term)) => {
|
||||||
for arg in prog.iter() {
|
for arg in &prog {
|
||||||
let mut child = Command::new(&command)
|
let mut child = Command::new(&command)
|
||||||
.arg(arg)
|
.arg(arg)
|
||||||
.arg(term)
|
.arg(term)
|
||||||
|
@ -24,7 +24,7 @@ impl Management {
|
|||||||
let man = match man {
|
let man = match man {
|
||||||
None => {
|
None => {
|
||||||
help();
|
help();
|
||||||
std::process::exit(0);
|
std::process::exit(0)
|
||||||
}
|
}
|
||||||
Some(val) => val,
|
Some(val) => val,
|
||||||
};
|
};
|
||||||
|
@ -91,7 +91,7 @@ impl<'a> PackageManager<'a> {
|
|||||||
// the current folder.
|
// the current folder.
|
||||||
pub fn set_default(&self) -> std::io::Result<()> {
|
pub fn set_default(&self) -> std::io::Result<()> {
|
||||||
let mut file = File::create("default.conf")?;
|
let mut file = File::create("default.conf")?;
|
||||||
file.write_all(format!("{}", self.name).as_bytes())?;
|
file.write_all(self.name.as_bytes())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,6 +100,7 @@ impl<'a> PackageManager<'a> {
|
|||||||
/// Pulls the first line out of the default.conf and loads that.
|
/// Pulls the first line out of the default.conf and loads that.
|
||||||
/// If it doesn't recognize the file it will tell the user that there's an
|
/// If it doesn't recognize the file it will tell the user that there's an
|
||||||
/// issue before exiting.
|
/// issue before exiting.
|
||||||
|
// TODO: Have this delete malformed default.conf
|
||||||
pub fn read_default<'a>() -> PackageManager<'a> {
|
pub fn read_default<'a>() -> PackageManager<'a> {
|
||||||
let file = File::open("default.conf").unwrap();
|
let file = File::open("default.conf").unwrap();
|
||||||
let buffered = BufReader::new(file);
|
let buffered = BufReader::new(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user