-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathhorned_materialize.rs
More file actions
41 lines (33 loc) · 1.03 KB
/
Copy pathhorned_materialize.rs
File metadata and controls
41 lines (33 loc) · 1.03 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use clap::App;
use clap::Arg;
use clap::ArgMatches;
use horned_bin::{config::parser_config, materialize};
use horned_owl::error::HornedError;
#[allow(dead_code)]
fn main() -> Result<(), HornedError> {
let matches = app("horned-materialize").get_matches();
matcher(&matches)
}
pub(crate) fn app(name: &str) -> App<'static> {
App::new(name)
.version(horned_bin::version_string())
.about("Parse an OWL file and download all the imports.")
.author("Phillip Lord")
.arg(
Arg::with_name("INPUT")
.help("Sets the input file to use")
.required(true)
.index(1),
)
}
pub(crate) fn matcher(matches: &ArgMatches) -> Result<(), HornedError> {
let input = matches
.value_of("INPUT")
.ok_or_else(|| HornedError::CommandError("Command requires a file argument".to_string()))?;
let v = materialize(input, parser_config(matches))?;
println!("Materialized");
for i in v {
println!("\t{i:?}");
}
Ok(())
}