Add count display.
This commit is contained in:
parent
87266e7d54
commit
abc6241353
2 changed files with 18 additions and 19 deletions
|
@ -4,7 +4,8 @@ fn main() {
|
||||||
let file = args().nth(1).expect("Usage : boxon <file>");
|
let file = args().nth(1).expect("Usage : boxon <file>");
|
||||||
let content = fs::read_to_string(&file).unwrap_or_else(|_| panic!("Could not read file '{file}'."));
|
let content = fs::read_to_string(&file).unwrap_or_else(|_| panic!("Could not read file '{file}'."));
|
||||||
let mut grid = Grid::from(content);
|
let mut grid = Grid::from(content);
|
||||||
grid.fix();
|
let count = grid.fix();
|
||||||
|
println!("Fixed {count} characters.");
|
||||||
let content: String = grid.into();
|
let content: String = grid.into();
|
||||||
fs::write(&file, content).unwrap_or_else(|_| panic!("Could not write result to file '{file}'."));
|
fs::write(&file, content).unwrap_or_else(|_| panic!("Could not write result to file '{file}'."));
|
||||||
}
|
}
|
||||||
|
|
34
test/out.txt
34
test/out.txt
|
@ -1,21 +1,19 @@
|
||||||
|
|
||||||
this is a normalized data table diagram.
|
this is a normalized data table diagram.
|
||||||
|
|
||||||
+----------------+
|
┌────────────────┐
|
||||||
|USERS BY EMAIL |
|
│USERS BY EMAIL │
|
||||||
+--+-----+-------+
|
├──┬─────┬───────┤
|
||||||
|id|email|user_id|
|
│id│email│user_id│
|
||||||
+--+-----+-------+
|
├──┼─────┼───────┤
|
||||||
| 1|b@o.b| 1|
|
│ 1│b@o.b│ 1│
|
||||||
| 2|c@r.l| 2|
|
│ 2│c@r.l│ 2│
|
||||||
+--+-----+-------+
|
└──┴─────┴───────┘
|
||||||
+---------------+
|
┌───────────────┐
|
||||||
|USERS |
|
│USERS │
|
||||||
+--+--------+---+
|
├──┬────────┬───┤
|
||||||
|id| name|age|
|
│id│ name│age│
|
||||||
+--+--------+---+
|
├──┼────────┼───┤
|
||||||
| 1| bob| 19|
|
│ 1│ bob│ 19│
|
||||||
| 2| charlie| 23|
|
│ 2│ charlie│ 23│
|
||||||
+--+--------+---+
|
└──┴────────┴───┘
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue