diff options
| author | Bernhard Guillon <Bernhard.Guillon@begu.org> | 2025-09-22 22:34:11 +0200 |
|---|---|---|
| committer | Bernhard Guillon <Bernhard.Guillon@begu.org> | 2025-09-22 22:34:11 +0200 |
| commit | e26be055fd1d939335c3f0334bb777ded6293ddf (patch) | |
| tree | f81510c62d668a2c6247a17c42907fa85f33828f /src/bin/main.rs | |
| parent | 6d19fca75510df17d6a14e35ac44845b8f43a695 (diff) | |
| download | future-me-e26be055fd1d939335c3f0334bb777ded6293ddf.tar.gz future-me-e26be055fd1d939335c3f0334bb777ded6293ddf.zip | |
Diffstat (limited to 'src/bin/main.rs')
| -rw-r--r-- | src/bin/main.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bin/main.rs b/src/bin/main.rs index c4e1b1f..ad61872 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -28,11 +28,12 @@ struct BugReport { status: String, title: String, description: Vec<String>, + parent: Option<String>, tags: Option<String>, version: String } -fn new_bug() -> String { +fn new_bug(parent: Option<String>) -> String { let editor = var("EDITOR").unwrap(); let mut file_path = temp_dir(); // TODO: figgure out how to get .git dir in a save manner file_path.push("NEW_BUG_REPORT"); @@ -62,6 +63,7 @@ fn new_bug() -> String { title: header.to_owned(), description: description.to_owned(), status: "new".to_owned(), + parent: parent, tags: None, version: "v1".to_owned(), }; @@ -104,7 +106,7 @@ fn hash_to_path(hash: &str) -> String { format!("{}/{}", &hash[..2], &hash[2..]) } -fn create_new_bug() { +fn create_new_bug(parent: Option<String>) { // first of all check if there is anything staged as we mess with the trees and staging area // use check_status for that // after that get the current tree get_current_tree and save it. We need to guarantee that @@ -148,7 +150,7 @@ fn create_new_bug() { Err(GitError::UnknownRef) => {create_new_tree(); None}, Err(_) => panic!("fixme"), }; - let bug_report = new_bug(); + let bug_report = new_bug(parent); let bug_object = create_object(bug_report.clone()).unwrap(); let path = hash_to_path(&bug_object); stage_object(&bug_object, &path); @@ -192,10 +194,12 @@ fn main() { show(); } Commands::New => { - create_new_bug(); + create_new_bug(None); } Commands::Reply { hash } => { - println!("Replying with: {}", hash); + let parent = short_to_long_hash(hash).unwrap(); + println!("Replying with: long: {}", parent); + create_new_bug(Some(parent)); } } } |
