Skip to content

Commit e7d985a

Browse files
committed
check multiple files
1 parent 441b0d1 commit e7d985a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/bin/mdr-meta.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ pub struct ToTomlArgs {
9393
#[command(alias = "ch")]
9494
pub struct CheckArgs {
9595
/// Input filename or "-" for STDIN
96-
#[arg(value_name = "FILE")]
97-
pub filename: String,
96+
#[arg(value_name = "FILE", num_args = 1..)]
97+
pub filenames: Vec<String>,
9898
}
9999

100100
// --------------------------------------------------
@@ -109,8 +109,16 @@ fn main() {
109109
fn run(args: Cli) -> Result<()> {
110110
match &args.command {
111111
Some(Command::Check(args)) => {
112-
let meta = parse_file(&args.filename)?;
113-
println!("{}", meta.check().join("\n"));
112+
let num_files = args.filenames.len();
113+
for filename in &args.filenames {
114+
if num_files > 1 {
115+
println!("==> {filename} <==")
116+
}
117+
match parse_file(filename) {
118+
Ok(meta) => println!("{}", meta.check().join("\n")),
119+
Err(e) => println!("{e}"),
120+
}
121+
}
114122
()
115123
}
116124
Some(Command::Example(args)) => {

0 commit comments

Comments
 (0)