This commit is contained in:
chaos 2024-11-18 19:34:28 +00:00
parent 858e492b9c
commit f103d12a03
7 changed files with 17 additions and 7 deletions

4
Cargo.lock generated
View file

@ -424,7 +424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "journal_types"
name = "journal"
version = "0.1.0"
dependencies = [
"chrono",
@ -582,7 +582,7 @@ dependencies = [
"chrono",
"chrono-tz",
"clap",
"journal_types",
"journal",
"log",
"prettytable-rs",
"serde",

View file

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
journal_types = { path = "./journal_types" }
journal = { path = "./journal" }
chrono = { version = "0.4.38", features = ["serde"] }
chrono-tz = { version = "0.10.0", features = ["serde"] }
clap = { version = "4.5.21", features = ["derive"] }

View file

@ -1,5 +1,5 @@
[package]
name = "journal_types"
name = "journal"
version = "0.1.0"
edition = "2021"

1
journal/src/lib.rs Normal file
View file

@ -0,0 +1 @@
pub mod types;

9
journal/src/types/mod.rs Normal file
View file

@ -0,0 +1,9 @@
mod types;
pub use {
types::AdministrationRoute,
types::Ingestion,
types::CustomSubstance,
types::Experience,
types::ExportData
};

View file

@ -71,4 +71,4 @@ pub struct ExportData {
//pub custom_substances: Vec<CustomSubstance>,
//pub custom_units: Vec<CustomUnit>,
pub experiences: Vec<Experience>,
}
}

View file

@ -1,12 +1,12 @@
use std::fs::File;
use std::env;
use journal_types;
use journal;
use serde_json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().collect();
let file = File::open(args[1].clone())?;
let mut export_data: journal_types::ExportData =
let mut export_data: journal::types::ExportData =
serde_json::from_reader(file)?;
export_data.experiences.sort_by(|a, b| a.modified_time.cmp(&b.modified_time));
for experience in export_data.experiences.iter_mut() {