From 806dab21b77eacbcb7e4ac9f667d213c0889be80 Mon Sep 17 00:00:00 2001
From: mihaicalinluca <mihaicalin.luca10@gmail.com>
Date: Tue, 10 Oct 2023 16:16:41 +0200
Subject: [PATCH 1/4] added no file and new file logs for test-gen in meta
 crate

---
 .../src/cmd/standalone/scen_test_gen/stg_main.rs | 11 +++++++++--
 .../cmd/standalone/scen_test_gen/stg_print.rs    | 16 ++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
index 521dd148fe..f19ac62888 100644
--- a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
+++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
@@ -5,6 +5,8 @@ use std::{
     path::{Path, PathBuf},
 };
 
+use colored::Colorize;
+
 use crate::folder_structure::{RelevantDirectories, RelevantDirectory};
 
 use super::{
@@ -28,6 +30,7 @@ pub fn perform_test_gen_all(path: impl AsRef<Path>, ignore: &[String], create: b
 
 fn perform_test_gen(contract_dir: &RelevantDirectory, create: bool) {
     let contract_dir_path = &contract_dir.path;
+
     let scenarios_dir = contract_dir_path.join(SCENARIOS_DIR_NAME);
     if !scenarios_dir.is_dir() {
         print_no_folder(contract_dir_path, SCENARIOS_DIR_NAME);
@@ -88,9 +91,11 @@ struct ProcessFileContext<'a> {
 }
 
 fn process_file(config: ProcessFileConfig, context: ProcessFileContext) {
-    let existing_file_path = find_test_file(context.test_dir, config.suffix);
+    let suffix = config.suffix;
+    let existing_file_path = find_test_file(context.test_dir, suffix);
 
     if existing_file_path.is_none() && !context.create_flag {
+        print_no_file(suffix);
         return;
     }
 
@@ -113,8 +118,10 @@ fn process_file(config: ProcessFileConfig, context: ProcessFileContext) {
         let file_name = format!("{}_{}", context.crate_name, config.suffix);
         context.test_dir.join(file_name)
     };
-    let mut file = File::create(file_path).unwrap();
+
+    let mut file = File::create(file_path.clone()).unwrap();
     write!(file, "{new_code}").unwrap();
+    print_new_file(&file_path);
 }
 
 fn find_test_file(test_dir: &Path, suffix: &str) -> Option<PathBuf> {
diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
index 0b14a15d23..93d2803333 100644
--- a/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
+++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
@@ -23,3 +23,19 @@ pub fn print_processing(test_file_path: &Path) {
         .green()
     );
 }
+
+pub fn print_no_file(suffix: &str) {
+    println!(
+        "{}", format!(
+            "No file ending in *_{suffix} found. Use the --create flag to create a new {suffix} file.",
+        )
+        .bright_red()
+    );
+}
+
+pub fn print_new_file(file_path: &Path) {
+    println!(
+        "{}",
+        format!("File {} has been created", file_path.display()).green()
+    );
+}

From 983881b9c6c91bfe6cafb74f9a82c953cc6d8eb4 Mon Sep 17 00:00:00 2001
From: mihaicalinluca <mihaicalin.luca10@gmail.com>
Date: Tue, 10 Oct 2023 20:06:53 +0200
Subject: [PATCH 2/4] clippy

---
 framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs | 2 --
 1 file changed, 2 deletions(-)

diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
index f19ac62888..be6b112414 100644
--- a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
+++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
@@ -5,8 +5,6 @@ use std::{
     path::{Path, PathBuf},
 };
 
-use colored::Colorize;
-
 use crate::folder_structure::{RelevantDirectories, RelevantDirectory};
 
 use super::{

From ed3756fd3fe64387f2c8f9da00a79193ae56ea9c Mon Sep 17 00:00:00 2001
From: mihaicalinluca <mihaicalin.luca10@gmail.com>
Date: Wed, 11 Oct 2023 01:28:52 +0200
Subject: [PATCH 3/4] fix after review

---
 .../meta/src/cmd/standalone/scen_test_gen/stg_main.rs      | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
index be6b112414..a6da013a00 100644
--- a/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
+++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_main.rs
@@ -117,9 +117,12 @@ fn process_file(config: ProcessFileConfig, context: ProcessFileContext) {
         context.test_dir.join(file_name)
     };
 
-    let mut file = File::create(file_path.clone()).unwrap();
+    let mut file = File::create(&file_path).unwrap();
     write!(file, "{new_code}").unwrap();
-    print_new_file(&file_path);
+
+    if existing_file_path.is_none() && context.create_flag {
+        print_new_file(&file_path);
+    }
 }
 
 fn find_test_file(test_dir: &Path, suffix: &str) -> Option<PathBuf> {

From c7bdd9059b5bc9c19713e2bb97feef5a7185714d Mon Sep 17 00:00:00 2001
From: Andrei Marinica <andrei.marinica@multiversx.com>
Date: Fri, 13 Oct 2023 10:28:38 +0300
Subject: [PATCH 4/4] warning in yellow

---
 framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
index 93d2803333..23add8d3cd 100644
--- a/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
+++ b/framework/meta/src/cmd/standalone/scen_test_gen/stg_print.rs
@@ -29,7 +29,7 @@ pub fn print_no_file(suffix: &str) {
         "{}", format!(
             "No file ending in *_{suffix} found. Use the --create flag to create a new {suffix} file.",
         )
-        .bright_red()
+        .yellow()
     );
 }