]>
Witch of Git - ivy/blob - src/bin/filecheck.rs
2 use std
::{io
::prelude
::*, process
};
5 let fname
= match std
::env
::args().nth(1) {
8 println
!("Usage: filecheck <pattern-file>");
13 let text
= match std
::fs
::read_to_string(&fname
) {
16 println
!("Error: failed to read '{}':\n{}", fname
, err
);
21 let checker
= match filecheck
::CheckerBuilder
::new().text(&text
) {
22 Ok(builder
) => builder
.fin
ish
(),
24 println
!("Error parsing check directives: {}", err
);
29 let mut buffer
= String
::new();
30 if let Err(err
) = std
::io
::stdin().read_to_string(&mut buffer
) {
31 println
!("Error reading from stdin: {}", err
);
35 let (success
, explanation
) = match checker
.explain(&buffer
, &()) {
38 println
!("Error checking: {}", err
);
44 println
!("{}", explanation
);