blob: 056bc8bb0abebf59b556190bbecc586fc838537f (
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 std::fs::symlink_metadata;
use std::path::{Path, PathBuf};
use structopt::StructOpt;
use summain::ManifestEntry;
fn main() -> anyhow::Result<()> {
let mut opt = Opt::from_args();
opt.pathnames[..].sort();
for pathname in opt.pathnames {
report(&pathname).with_context(|| format!("{}", pathname.display()))?
}
Ok(())
}
#[derive(StructOpt, Debug)]
struct Opt {
#[structopt(parse(from_os_str))]
pathnames: Vec<PathBuf>,
}
fn report(pathname: &Path) -> anyhow::Result<()> {
let m = symlink_metadata(pathname)?;
let e = ManifestEntry::new(pathname, m);
println!("{}", serde_yaml::to_string(&e)?);
Ok(())
}
|