redox/src/bin/find_recipe.rs
Josh Megnauth 0ae1974a03
Move struct Package to redox-pkg
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.
2025-07-05 07:48:28 -04:00

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);
}
}
}