Add subcommand 'diff' to compare two OSC files

This commit is contained in:
2023-07-01 17:29:53 +02:00
parent b04ee563f2
commit b030ce6a53
9 changed files with 209 additions and 7 deletions

View File

@@ -24,6 +24,9 @@
use crate::profile::{FormReference, Profile};
use serde::{Deserialize, Serialize};
use std::collections::hash_map::DefaultHasher;
use std::fmt::Debug;
use std::hash::{Hash, Hasher};
pub mod data_catalogue;
pub mod data_form;
@@ -238,6 +241,16 @@ pub trait Sortable {
fn sorting_key(&self) -> String;
}
pub trait Comparable: Debug {
fn get_name(&self) -> String;
fn get_revision(&self) -> u16;
fn get_hash(&self) -> String {
let mut h = DefaultHasher::new();
format!("{:?}", self).hash(&mut h);
h.finish().to_string()
}
}
pub trait FormEntry {
fn get_name(&self) -> String;
fn get_type(&self) -> String;