Commit 15d37cea authored by Jeremy Soller's avatar Jeremy Soller Committed by GitHub

Merge pull request #4 from ids1024/list

--list-packages argument
parents d6f2936a e47108a7
......@@ -15,6 +15,7 @@ fn main() {
let mut configs = vec![];
let mut cookbook = None;
let mut list_packages = false;
for arg in env::args().skip(1) {
if arg.starts_with("--cookbook=") {
let path = arg.splitn(2, "--cookbook=").nth(1).unwrap().to_string();
......@@ -27,6 +28,11 @@ fn main() {
continue;
}
if arg == "--list-packages" {
list_packages = true;
continue;
}
match File::open(&arg) {
Ok(mut config_file) => {
let mut config_data = String::new();
......@@ -72,7 +78,11 @@ fn main() {
}
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();
process::exit(1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment