Small tweaks
This commit is contained in:
parent
8e43af7913
commit
1ff420fb49
@ -24,6 +24,7 @@ impl Config {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// takes `Some(Vec<&str>)` and returns `Vec<&str>`
|
// takes `Some(Vec<&str>)` and returns `Vec<&str>`
|
||||||
|
// checks to make sure the package manager supports the action
|
||||||
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");
|
||||||
@ -34,8 +35,9 @@ impl Config {
|
|||||||
|
|
||||||
//Pop's from the front of the `Vec<&str>`, which should always be the command name
|
//Pop's from the front of the `Vec<&str>`, which should always be the command name
|
||||||
let command = prog.remove(0);
|
let command = prog.remove(0);
|
||||||
// Matches against a tuple of the first element of the `Vec` and the `&Option<String>`
|
// Tuple match, `prog.first()` returns an `Option<T>` on the first element of
|
||||||
// from the passed `Config`, taking a reference to that data when it needs it.
|
// a Vec, `self.term` is also an `Option<T>` so this checks both for `Some`/`None`
|
||||||
|
// and formats the program as needed
|
||||||
match (prog.first(), &self.term) {
|
match (prog.first(), &self.term) {
|
||||||
(None, &None) => {
|
(None, &None) => {
|
||||||
let mut child = Command::new(&command).spawn().expect(
|
let mut child = Command::new(&command).spawn().expect(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user