mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-07-06 11:38:41 +08:00
This deduplicates code as well as forces names to be sanitized. The API for both redox-pkg and cookbook need some reimagining due to the reshuffling, but this patch is not concerned with that as yet.
26 lines
507 B
Rust
26 lines
507 B
Rust
use std::env::args;
|
|
use std::process::exit;
|
|
|
|
use pkg::recipes;
|
|
|
|
fn usage() {
|
|
println!("Usage: find_recipe recipe_name");
|
|
}
|
|
fn main() {
|
|
if args().len() != 2 {
|
|
usage();
|
|
exit(2);
|
|
}
|
|
let recipe_name = &args().last().unwrap();
|
|
match recipes::find(recipe_name) {
|
|
Some(path) => {
|
|
println!("{}", path.display());
|
|
exit(0);
|
|
}
|
|
None => {
|
|
eprintln!("recipe {} not found", recipe_name);
|
|
exit(1);
|
|
}
|
|
}
|
|
}
|