Removes the TUI in favor of event based logging #15
1 changed files with 12 additions and 3 deletions
|
@ -4,6 +4,7 @@ use std::fs::OpenOptions;
|
|||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use crate::write_error;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub(crate) struct SeriesHistory {
|
||||
|
@ -11,7 +12,7 @@ pub(crate) struct SeriesHistory {
|
|||
}
|
||||
|
||||
impl SeriesHistory {
|
||||
pub(crate) fn load_history() -> Result<Self, String> {
|
||||
pub(crate) fn load_history() -> Result<Self, ()> {
|
||||
let path = confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "config").expect("Something went wrong with confy");
|
||||
let config_dir = path.parent().expect("Something went wrong with confy");
|
||||
|
||||
|
@ -21,7 +22,11 @@ impl SeriesHistory {
|
|||
true => {
|
||||
let file_contents: String = match fs::read_to_string("history.toml") {
|
||||
Ok(data) => data,
|
||||
Err(e) => return Err(format!("{}", e)),
|
||||
Err(e) => {
|
||||
let err_msg = format!("{e}");
|
||||
write_error(err_msg);
|
||||
return Err(())
|
||||
},
|
||||
};
|
||||
|
||||
let history: Result<SeriesHistory, toml::de::Error> = match file_contents.len() {
|
||||
|
@ -33,7 +38,11 @@ impl SeriesHistory {
|
|||
|
||||
match history {
|
||||
Ok(data) => Ok(data),
|
||||
Err(e) => Err(format!("{}", e))
|
||||
Err(e) => {
|
||||
let err_msg = format!("{e}");
|
||||
write_error(err_msg);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
},
|
||||
false => {
|
Loading…
Reference in a new issue