blob: a2e2b7a230352e05bce666e10c8ee1b12f05f7cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use anyhow::Context;
use rayon::prelude::*;
use std::path::{Path, PathBuf};
use structopt::StructOpt;
use summain::ManifestEntry;
fn main() -> anyhow::Result<()> {
let mut opt = Opt::from_args();
opt.pathnames[..].sort();
let v: Vec<anyhow::Result<ManifestEntry>> =
opt.pathnames.par_iter().map(|p| manifest(&p)).collect();
for m in v {
let m = m?;
print!("{}", serde_yaml::to_string(&m)?);
}
Ok(())
}
#[derive(StructOpt, Debug)]
struct Opt {
#[structopt(parse(from_os_str))]
pathnames: Vec<PathBuf>,
}
fn manifest(path: &Path) -> anyhow::Result<ManifestEntry> {
ManifestEntry::new(path).with_context(|| format!("{}", path.display()))
}
|