mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-07-03 09:12:54 +00:00
Issue #15: Implement check subcommand cli
This commit is contained in:
@ -24,7 +24,7 @@
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::fmt::Debug;
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use crate::model::requirements::Requires;
|
||||
@ -329,3 +329,25 @@ pub trait FolderContent {
|
||||
"ONKOSTAR Bibliothek" == self.get_library_folder()
|
||||
}
|
||||
}
|
||||
|
||||
pub enum CheckNotice {
|
||||
/// This will result in Error if importing file
|
||||
Error { code: String, description: String },
|
||||
/// Other known issues
|
||||
Warning { description: String },
|
||||
}
|
||||
|
||||
impl Display for CheckNotice {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
CheckNotice::Error { code, description } => {
|
||||
write!(f, "[ERROR] ({}) {}", code, description)
|
||||
}
|
||||
CheckNotice::Warning { description } => write!(f, "[WARNING] {}", description),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Checkable {
|
||||
fn check(&self) -> Vec<CheckNotice>;
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ use crate::model::data_form::DataForm;
|
||||
use crate::model::property_catalogue::PropertyCatalogue;
|
||||
use crate::model::requirements::Requires;
|
||||
use crate::model::unterformular::Unterformular;
|
||||
use crate::model::{Comparable, FolderContent, FormEntryContainer, Listable, Sortable};
|
||||
use crate::model::{
|
||||
CheckNotice, Checkable, Comparable, FolderContent, FormEntryContainer, Listable, Sortable,
|
||||
};
|
||||
use crate::profile::Profile;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@ -409,6 +411,12 @@ impl FromStr for OnkostarEditor {
|
||||
}
|
||||
}
|
||||
|
||||
impl Checkable for OnkostarEditor {
|
||||
fn check(&self) -> Vec<CheckNotice> {
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct InfoXML {
|
||||
|
Reference in New Issue
Block a user