fix
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub mod detections;
|
||||
pub mod models;
|
||||
pub mod omikuji;
|
||||
pub mod toml;
|
||||
|
||||
@@ -7,6 +7,7 @@ use quick_xml::de::DeError;
|
||||
use std::{fs, path::PathBuf, process};
|
||||
use yamato_event_analyzer::detections::detection;
|
||||
use yamato_event_analyzer::toml;
|
||||
use yamato_event_analyzer::omikuji::Omikuji;
|
||||
|
||||
fn build_app() -> clap::App<'static, 'static> {
|
||||
let program = std::env::args()
|
||||
@@ -43,7 +44,7 @@ fn main() -> Result<(), DeError> {
|
||||
if let Some(filepath) = filepath {
|
||||
parse_file(filepath);
|
||||
}
|
||||
|
||||
output_with_omikuji(Omikuji::DAIKICHI);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -61,8 +62,8 @@ fn parse_file(filepath: &str) {
|
||||
&detection.start(parser);
|
||||
}
|
||||
|
||||
fn output_with_omikuji(severity: &str) {
|
||||
let fp = &format!("art/omikuji/{}.txt", severity);
|
||||
fn output_with_omikuji(omikuji: Omikuji) {
|
||||
let fp = &format!("art/omikuji/{}", omikuji.get_file_name());
|
||||
let content = fs::read_to_string(fp).unwrap();
|
||||
println!("{}", content);
|
||||
}
|
||||
|
||||
22
src/omikuji.rs
Normal file
22
src/omikuji.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
pub enum Omikuji {
|
||||
DAIKICHI,
|
||||
KICHI,
|
||||
CHUKICHI,
|
||||
SHOUKICHI,
|
||||
SUEKICHI,
|
||||
KYOU,
|
||||
}
|
||||
|
||||
impl Omikuji {
|
||||
pub fn get_file_name(&self) -> String {
|
||||
let file_name = match *self {
|
||||
Omikuji::DAIKICHI => "DAIKICHI.txt",
|
||||
Omikuji::KICHI => "KICHI.txt",
|
||||
Omikuji::CHUKICHI => "CHUKICHI.txt",
|
||||
Omikuji::SHOUKICHI => "SHOUKICHI.txt",
|
||||
Omikuji::SUEKICHI => "SUEKICHI.txt",
|
||||
Omikuji::KYOU => "KYOU.txt",
|
||||
};
|
||||
file_name.to_string()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user