crude multiple input
This commit is contained in:
parent
0c75859cd2
commit
54278f5506
1 changed files with 17 additions and 12 deletions
19
src/main.rs
19
src/main.rs
|
@ -6,28 +6,33 @@ use crate::raw_data::RawJobStats;
|
|||
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
fn get_job_stats(lodestone_id: usize) -> anyhow::Result<Vec<JobStats>> {
|
||||
fn get_job_stats(lodestone_ids: &[usize]) -> anyhow::Result<Vec<Vec<JobStats>>> {
|
||||
let mut player_stats = Vec::new();
|
||||
for id in lodestone_ids {
|
||||
let output = Command::new("lodestone-fetcher")
|
||||
.arg(lodestone_id.to_string())
|
||||
.arg(id.to_string())
|
||||
.stdout(Stdio::piped())
|
||||
.output()
|
||||
.expect("Failed to execute lodestone-fetcher");
|
||||
|
||||
let raw: Vec<RawJobStats> = serde_json::from_reader(&output.stdout[..])?;
|
||||
|
||||
Ok(raw.into_iter().map(|r| r.into()).collect())
|
||||
player_stats.push(Ok(raw.into_iter().map(|r| r.into()).collect()));
|
||||
}
|
||||
|
||||
player_stats.into_iter().collect()
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let id = 29932586; // Binglesworth
|
||||
let stats = get_job_stats(id)?;
|
||||
display_stats(id, &stats);
|
||||
let stats = get_job_stats(std::slice::from_ref(&id))?;
|
||||
display_stats(id, &stats[0]);
|
||||
|
||||
println!();
|
||||
|
||||
let id = 44540671; // Dialus
|
||||
let stats = get_job_stats(id)?;
|
||||
display_stats(id, &stats);
|
||||
let stats = get_job_stats(std::slice::from_ref(&id))?;
|
||||
display_stats(id, &stats[0]);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue