aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBernhard Guillon <Bernhard.Guillon@begu.org>2025-09-16 22:51:36 +0200
committerBernhard Guillon <Bernhard.Guillon@begu.org>2025-09-16 22:51:36 +0200
commit99f8dcce0276dbc7df2689e8f8b101ab31b4746d (patch)
tree47a1cc19adef9be296d326edf586599689c2e5ca /src
parentd077a58bdf3f76f935504aecc9fde9e3d6093e5b (diff)
downloadfuture-me-99f8dcce0276dbc7df2689e8f8b101ab31b4746d.tar.gz
future-me-99f8dcce0276dbc7df2689e8f8b101ab31b4746d.zip
future-me: add a hacky way to list all bug reports
================================================================= new | Hello world +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ this is my first bug report ================================================================= new | Hello second bug +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This is the second bug yey - looks nice
Diffstat (limited to 'src')
-rw-r--r--src/main.rs58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 7248942..a25a5f7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,7 +9,7 @@ use std::{
};
use std::fs;
-#[derive(Serialize, Deserialize)]
+#[derive(Serialize, Deserialize, Debug)]
struct BugReport {
timestamp: String,
status: String,
@@ -56,6 +56,60 @@ fn new_bug() {
print!("{}", j);
}
+fn show() {
+ let reports = get_reports();
+ for report in reports {
+ //println!("{:?}", report);
+ println!("=================================================================");
+ println!("{} | {}", report.status, report.title);
+ println!("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+ for l in report.description {
+ println!("{}", l);
+ }
+ }
+}
+
+fn get_reports() -> Vec<BugReport> {
+ let mut ret: Vec<BugReport> = Vec::new();
+ let output = Command::new("git")
+ .arg("ls-tree")
+ .arg("--full-tree")
+ .arg("-r")
+ .arg("refs/notes/devtools/future-me")
+ .output()
+ .expect("Error with git ls-tree");
+ //println!("{}", output.status);
+ if output.status.success() {
+ let lines = String::from_utf8_lossy(&output.stdout);
+ for line in lines.lines() {
+ if let Some(after_blob) = line.split_once("blob ") {
+ if let Some((hash, _)) = after_blob.1.split_once('\t') {
+ let blob = Command::new("git")
+ .arg("cat-file")
+ .arg("-p")
+ .arg(hash)
+ .output()
+ .expect("Error with git cat-file");
+ if blob.status.success() {
+ let lines = String::from_utf8_lossy(&blob.stdout);
+ // TODO: error handling
+ let bug_report: BugReport = serde_json::from_str(&lines).unwrap();
+ ret.push(bug_report);
+ }
+ else {
+ println!("{}", String::from_utf8_lossy(&blob.stderr));
+ }
+ }
+ }
+ }
+ }
+ else {
+ println!("{}", String::from_utf8_lossy(&output.stderr));
+ }
+ ret
+}
+
fn main() {
- new_bug();
+ //new_bug();
+ show();
}