~deciduously/fcalc

ref: 5ba32ecfb93e39f3b11e2abaa2ba6d5c7c848544 fcalc/src/bin/fcalc.rs -rw-r--r-- 480 bytes
5ba32ecfBen Lovy Recipe lookup a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Simple CLI to request recipes.

#![cfg(feature = "bin")]

use fcalc::{ITEMS, RECIPES};
use lazy_static::lazy_static;
use std::env::var;

lazy_static! {
    pub static ref VERSION: String = var("CARGO_PKG_VERSION").unwrap();
}

fn main() {
    println!("fcalc {} - Factorio Calculator", *VERSION);
    let product = ITEMS.lookup("Iron Plate").unwrap().as_product().unwrap();
    let recipe = RECIPES.lookup(&product).unwrap();
    println!("To get {}:\n{}", product, recipe)
}