Merge pull request #34 from hexedtech/fix/sorted-tree

feat: sort filetree before returning it
This commit is contained in:
əlemi 2024-10-01 00:23:42 +02:00 committed by GitHub
commit 5e2e711b55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -286,7 +286,7 @@ impl Workspace {
/// A filter may be applied, and it may be strict (equality check) or not (starts_with check). /// A filter may be applied, and it may be strict (equality check) or not (starts_with check).
// #[cfg_attr(feature = "js", napi)] // https://github.com/napi-rs/napi-rs/issues/1120 // #[cfg_attr(feature = "js", napi)] // https://github.com/napi-rs/napi-rs/issues/1120
pub fn filetree(&self, filter: Option<&str>, strict: bool) -> Vec<String> { pub fn filetree(&self, filter: Option<&str>, strict: bool) -> Vec<String> {
self.0 let mut tree = self.0
.filetree .filetree
.iter() .iter()
.filter(|f| { .filter(|f| {
@ -299,7 +299,9 @@ impl Workspace {
}) })
}) })
.map(|f| f.clone()) .map(|f| f.clone())
.collect() .collect::<Vec<String>>();
tree.sort();
tree
} }
pub(crate) fn run_actor( pub(crate) fn run_actor(