parsed `pijul log` text blob into individual entries & fields
Dependencies
- [2]
IQY5LHENadd GUI element to display simple `pijul log` results - [3]
NSE6BLWAinit slint project from https://github.com/slint-ui/slint-rust-template - [4]
4RPYR65Cconnect GUI to pijul to display simple channel list - [*]
NCRTU7M4cargo init
Change contents
- edit in ui/app-window.slint at line 2
export struct ChangeData {hash: string,// TODO display all authors// authors: [string],author: string,timestamp: string,message: string,}component ChangeEntry {in-out property <string> hash;in-out property <string> author;in-out property <string> timestamp;in-out property <string> message;VerticalBox {spacing: 0;Text {text: "hash \{root.hash}";}Text {text: "author \{root.author}";} - edit in ui/app-window.slint at line 28
Text {text: "timestamp \{root.timestamp}";}HorizontalBox {alignment: start;spacing: 0;padding: 5px;Rectangle {width: 10px;visible: false;}Text {text: "\{root.message}";}}}} - replacement in ui/app-window.slint at line 51
in-out property <string> changes_log: "";in-out property <[ChangeData]> changes_log: []; - replacement in ui/app-window.slint at line 90
Text {text: "\{root.changes_log}";for change in root.changes_log: ChangeEntry {hash: change.hash;author: change.author;timestamp: change.timestamp;message: change.message; - replacement in src/main.rs at line 10
use slint::SharedString;use slint::{ModelRc, SharedString}; - replacement in src/main.rs at line 53
ui.set_changes_log(SharedString::from(&log));let log_strs: Vec<ChangeData> = log.into_iter().map(|change| ChangeData {hash: change.hash.into(),author: change.authors.first().unwrap_or(&String::new()).clone().into(),timestamp: change.timestamp.into(),message: change.message.into(),}).collect();ui.set_changes_log((&log_strs[..]).into()); - replacement in src/cmds.rs at line 16
pub fn log(exe: &std::path::Path, repo: &std::path::Path) -> Result<String, Error> {pub fn log(exe: &std::path::Path, repo: &std::path::Path) -> Result<Vec<ChangelogEntry>, Error> { - replacement in src/cmds.rs at line 22
.arg(repo);.arg(repo).arg("--output-format").arg("json"); - replacement in src/cmds.rs at line 27
Ok(String::from_utf8(output.stdout)?)Ok(serde_json::from_slice(&output.stdout)?) - edit in src/cmds.rs at line 47
}#[derive(serde::Serialize, serde::Deserialize, Debug)]pub struct ChangelogEntry {pub(crate) hash: String,pub(crate) authors: Vec<String>,pub(crate) timestamp: String,pub(crate) message: String, - edit in Cargo.toml at line 10
serde = { version = "1.0.210", features = ["derive"] }serde_json = "1.0.128" - edit in Cargo.lock at line 2804
"serde","serde_json",