Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factorize function #102

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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