Add subcommands 'list' and 'modify'

This commit is contained in:
2023-06-03 15:27:09 +02:00
parent 5681b1dee3
commit ca145f5e4b
9 changed files with 290 additions and 48 deletions

View File

@@ -22,6 +22,7 @@
* SOFTWARE.
*/
use console::style;
use serde::{Deserialize, Serialize};
use crate::model::data_catalogue::DataCatalogue;
@@ -47,6 +48,49 @@ impl OnkostarEditor {
data_form.apply_variant();
})
}
pub fn list_forms(&self) {
println!(
"{}",
style("In der Datei sind folgende Inhalte gespeichert\n").bold()
);
println!(
"{} {}",
self.editor.property_catalogue.len(),
style("Merkmalskataloge").underlined()
);
self.editor
.property_catalogue
.iter()
.for_each(|data_form| println!("{}", data_form.to_listed_string()));
println!(
"\n{} {}",
self.editor.data_catalogue.len(),
style("Datenkataloge").underlined()
);
self.editor
.data_catalogue
.iter()
.for_each(|data_form| println!("{}", data_form.to_listed_string()));
println!(
"\n{} {}",
self.editor.data_form.len(),
style("Formulare").underlined()
);
self.editor
.data_form
.iter()
.for_each(|data_form| println!("{}", data_form.to_listed_string()));
println!(
"\n{} {}",
self.editor.unterformular.len(),
style("Unterformulare").underlined()
);
self.editor
.unterformular
.iter()
.for_each(|data_form| println!("{}", data_form.to_listed_string()));
}
}
#[derive(Serialize, Deserialize, Debug)]