-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
96 lines (87 loc) · 2.42 KB
/
main.rs
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//! A rust port of kaityo256's ``yaml_cv``
#![warn(
elided_lifetimes_in_paths,
keyword_idents,
macro_use_extern_crate,
missing_docs,
non_ascii_idents,
noop_method_call,
unreachable_pub,
unused_crate_dependencies,
unused_import_braces,
unused_lifetimes,
unused_macro_rules,
unused_results,
clippy::pedantic,
clippy::negative_feature_names,
clippy::redundant_feature_names,
clippy::wildcard_dependencies,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_underscore,
clippy::clone_on_ref_ptr,
clippy::dbg_macro,
clippy::default_union_representation,
clippy::empty_structs_with_brackets,
clippy::filetype_is_file,
clippy::fn_to_numeric_cast_any,
clippy::format_push_string,
clippy::if_then_some_else_none,
clippy::integer_division,
clippy::let_underscore_must_use,
clippy::map_err_ignore,
clippy::mixed_read_write_in_expression,
clippy::mod_module_files,
clippy::multiple_inherent_impl,
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::shadow_unrelated,
clippy::str_to_string,
clippy::string_to_string,
clippy::todo,
clippy::try_err,
clippy::undocumented_unsafe_blocks,
clippy::unimplemented,
clippy::unseparated_literal_suffix,
clippy::unwrap_in_result,
clippy::unwrap_used,
clippy::use_debug,
clippy::verbose_file_reads,
clippy::cognitive_complexity,
clippy::suboptimal_flops
)]
#![deny(
missing_abi,
pointer_structural_match,
unsafe_op_in_unsafe_fn,
clippy::default_numeric_fallback,
clippy::float_cmp_const,
clippy::indexing_slicing,
clippy::lossy_float_literal,
clippy::mem_forget,
clippy::string_slice,
clippy::debug_assert_with_mut_call
)]
#![forbid(unsafe_code)]
use anyhow::Result;
use clap::Parser;
use serde_yaml::from_str;
use std::fs::read_to_string;
mod args;
mod cv;
mod style;
mod yaml;
fn main() -> Result<()> {
let cli = args::Args::parse();
let raw_input_file = read_to_string(&cli.input)?;
let input_file: yaml::YAMLArgs = from_str(&raw_input_file)?;
let style_file = style::read(&cli.style)?;
cv::make(cli.output.as_path(), style_file, &input_file)?;
println!(
"input file: {}\nstyle file: {}\noutput file: {}\nDone.",
&cli.input.display(),
&cli.style.display(),
&cli.output.display()
);
Ok(())
}