Skip to content
Snippets Groups Projects
Commit 15d37cea authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub
Browse files

Merge pull request #4 from ids1024/list

--list-packages argument
parents d6f2936a e47108a7
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ fn main() { ...@@ -15,6 +15,7 @@ fn main() {
let mut configs = vec![]; let mut configs = vec![];
let mut cookbook = None; let mut cookbook = None;
let mut list_packages = false;
for arg in env::args().skip(1) { for arg in env::args().skip(1) {
if arg.starts_with("--cookbook=") { if arg.starts_with("--cookbook=") {
let path = arg.splitn(2, "--cookbook=").nth(1).unwrap().to_string(); let path = arg.splitn(2, "--cookbook=").nth(1).unwrap().to_string();
...@@ -27,6 +28,11 @@ fn main() { ...@@ -27,6 +28,11 @@ fn main() {
continue; continue;
} }
if arg == "--list-packages" {
list_packages = true;
continue;
}
match File::open(&arg) { match File::open(&arg) {
Ok(mut config_file) => { Ok(mut config_file) => {
let mut config_data = String::new(); let mut config_data = String::new();
...@@ -72,7 +78,11 @@ fn main() { ...@@ -72,7 +78,11 @@ fn main() {
} }
for config in configs { for config in configs {
if let Err(err) = redox_installer::install(config, cookbook.as_ref().map(String::as_ref)) { if list_packages {
for (packagename, _package) in &config.packages {
println!("{}", packagename);
}
} else if let Err(err) = redox_installer::install(config, cookbook.as_ref().map(String::as_ref)) {
writeln!(stderr, "installer: failed to install: {}", err).unwrap(); writeln!(stderr, "installer: failed to install: {}", err).unwrap();
process::exit(1); process::exit(1);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment