From 18e92e9a93bd63fccd29cb1c65a044907bdc981a Mon Sep 17 00:00:00 2001
From: "iliya.saroukha" <iliya.saroukha@hes-so.ch>
Date: Thu, 9 Feb 2023 11:22:06 +0100
Subject: [PATCH] storing print to stdout functions into separate file

---
 src/to_stdout/mod.rs | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 src/to_stdout/mod.rs

diff --git a/src/to_stdout/mod.rs b/src/to_stdout/mod.rs
new file mode 100644
index 0000000..de14034
--- /dev/null
+++ b/src/to_stdout/mod.rs
@@ -0,0 +1,43 @@
+use ptree::{print_tree, TreeBuilder};
+
+pub fn algo_tree() {
+    let tree = TreeBuilder::new("<name_data_struct>".to_string())
+        .begin_child("struct".to_string())
+        .add_empty_child("<name_data_struct>.h".to_string())
+        .add_empty_child("<name_data_struct>.c".to_string())
+        .end_child()
+        .add_empty_child("<name_main_file>.c".to_string())
+        .add_empty_child("Makefile".to_string())
+        .build();
+
+    print_tree(&tree).expect("Not able to print");
+    println!();
+}
+
+pub fn exam_tree() {
+    let tree = TreeBuilder::new("prog_seq_exam_<month>".to_string())
+        .begin_child("ex1".to_string())
+        .add_empty_child("ex1.c".to_string())
+        .add_empty_child("Makefile".to_string())
+        .end_child()
+        .begin_child("ex...".to_string())
+        .add_empty_child("etc...".to_string())
+        .end_child()
+        .build();
+
+    print_tree(&tree).expect("Not able to print");
+    println!();
+}
+
+pub fn print_menu() {
+    println!();
+    println!(" --------------------------------------- ");
+    println!("|\tWelcome to CREATE-PROG-APP\t|");
+    println!(" --------------------------------------- ");
+    println!("What kind of template do you want?");
+    println!();
+    println!("1) Algo");
+    algo_tree();
+    println!("2) Exam");
+    exam_tree();
+}
-- 
GitLab