fix: create all permutations of depth for tree command

This commit is contained in:
Moritz Böhme 2025-02-23 18:20:42 +01:00
parent a58da2ffda
commit 28881a4ec5
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9

View file

@ -95,14 +95,12 @@ pub fn create_tag_combinations(tags: &[String], depth: usize) -> Vec<Vec<String>
// Start with existing combinations of length-1
for combo in result.iter().filter(|c| c.len() == len - 1) {
// Try to add each remaining tag that comes after the last tag in combo
if let Some(last) = combo.last() {
for tag in tags {
if tag > last && !combo.contains(tag) {
let mut new_combo = combo.clone();
new_combo.push(tag.clone());
temp.push(new_combo);
}
// Try to add each remaining tag
for tag in tags {
if !combo.contains(tag) {
let mut new_combo = combo.clone();
new_combo.push(tag.clone());
temp.push(new_combo);
}
}
}