diff options
author | Azad <49314270+Akmadan23@users.noreply.github.com> | 2024-03-14 17:05:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 12:05:42 -0400 |
commit | 2536838ce31955ec55561aabb4b86fdd4bc984df (patch) | |
tree | 186952491a26613054c338046ff96df411b7c34d /src/commands/sort.rs | |
parent | 9339b90cd4a8b26aaa57d63b90c633f427990745 (diff) |
feat: add `--reverse` flag to sort methods (#507)
Diffstat (limited to 'src/commands/sort.rs')
-rw-r--r-- | src/commands/sort.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/commands/sort.rs b/src/commands/sort.rs index 7bea48f..fa597c1 100644 --- a/src/commands/sort.rs +++ b/src/commands/sort.rs @@ -5,13 +5,18 @@ use crate::history::DirectoryHistory; use super::reload; -pub fn set_sort(context: &mut AppContext, method: SortType) -> AppResult { +pub fn set_sort(context: &mut AppContext, method: SortType, reverse: Option<bool>) -> AppResult { let curr_tab = context.tab_context_mut().curr_tab_mut(); curr_tab .option_mut() .sort_options_mut() .set_sort_method(method); curr_tab.history_mut().depreciate_all_entries(); + + if let Some(r) = reverse { + curr_tab.option_mut().sort_options_mut().reverse = r; + } + refresh(context) } |