| 1 |
use onenote_parser::Parser; |
| 2 |
use std::env; |
| 3 |
use std::ffi::OsString; |
| 4 |
use std::path::PathBuf; |
| 5 |
|
| 6 |
fn main() { |
| 7 |
let path = env::args().nth(1).expect("usage: parse <file>"); |
| 8 |
let path = PathBuf::from(path); |
| 9 |
|
| 10 |
let mut parser = Parser::new(); |
| 11 |
if path.extension() == Some(&OsString::from("onetoc2".to_string())) { |
| 12 |
let notebook = parser.parse_notebook(&path).unwrap(); |
| 13 |
println!("{:#?}", notebook); |
| 14 |
} else { |
| 15 |
let section = parser.parse_section(&path).unwrap(); |
| 16 |
println!("{:#?}", section); |
| 17 |
} |
| 18 |
} |