diff --git a/src/lib.rs b/src/lib.rs index 6bfad07..b2e7303 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -184,6 +184,17 @@ fn create_frame_string(value: Vec) -> String { .join(",") } +/// This part of the code is not already used +#[allow(dead_code)] +fn concat_line(main_string: String, frame_string: String) -> String { + let buf: bool = false; + if buf { + let from: String = String::from("#####"); + main_string.replace(&from, &frame_string) + } else { + format!("{}@{}", main_string, frame_string) + } +} /// ## Basic listing of the library /// ### Description /// @@ -328,3 +339,10 @@ fn test_create_frame_string() { let expected: String = "1-3,5".to_string(); assert_eq!(expected, create_frame_string(source)); } +#[test] +fn test_concat_line() { + let main_string: String = String::from("toto"); + let frame_string: String = String::from("bar"); + let expected: String = String::from("toto@bar"); + assert_eq!(expected, concat_line(main_string, frame_string)); +} diff --git a/src/main.rs b/src/main.rs index 338b428..beffa34 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,9 @@ struct Args { /// Represent output as a tree #[arg(short, long)] tree: bool, + /// Display Buf format + #[arg(short, long)] + buf: bool, /// Path to parse #[arg(value_name = "PATH", default_value_t = String::from("./"))]