Skip to content

Commit

Permalink
factorize function
Browse files Browse the repository at this point in the history
  • Loading branch information
doubleailes committed Jul 7, 2023
1 parent 941eb86 commit e724bc9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "framels"
version = "0.3.8"
version = "0.3.9"
edition = "2021"
authors = ["Philippe Llerena<[email protected]>"]
description = "a simple command line tool to list frame sequence in friendly way"
Expand Down
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,20 @@ fn test_convert_vec_to_str() {
assert_eq!(expected, convert_vec_to_str(source));
}

fn create_frame_string(value: Vec<String>) -> String {
let converted_vec_isize: Vec<isize> = convert_vec(value);
let group_continuity: Vec<Vec<isize>> = group_continuity(&converted_vec_isize);
convert_vec_to_str(group_continuity)
}

pub fn basic(frames: Vec<String>) -> Vec<String> {
let frames_dict: HashMap<String, Vec<String>> = parse_result(frames);
let mut out_frames: Vec<String> = Vec::new();
for (key, value) in frames_dict {
if value[0] == "None" && value.len() == 1 {
out_frames.push(key);
} else {
let i = convert_vec(value);
let j = group_continuity(&i);
let k = convert_vec_to_str(j);
out_frames.push(format!("{}@{}", key, k));
out_frames.push(format!("{}@{}", key, create_frame_string(value)));
}
}
out_frames
Expand All @@ -192,10 +195,7 @@ pub fn listing(root_path: String, frames: Vec<String>) -> Vec<String> {
let path = format!("{}{}", root_path, new_path);
read_meta(path);
};
let i = convert_vec(value);
let j = group_continuity(&i);
let k = convert_vec_to_str(j);
out_frames.push(format!("{}@{}", key, k));
out_frames.push(format!("{}@{}", key, create_frame_string(value)));
}
}
out_frames
Expand Down

0 comments on commit e724bc9

Please sign in to comment.