blob: 935e7fdb59d9c317354e1ab32ddc084ddd068cd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
use std::path;
use crate::commands::{JoshutoCommand, JoshutoRunnable};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::ui::TuiBackend;
use crate::sort::SortType;
use crate::HOME_DIR;
#[derive(Clone, Debug)]
pub struct Sort {
sort_method: SortType,
}
impl Sort {
pub fn new(sort_method: SortType) -> Self {
Self { sort_method }
}
pub const fn command() -> &'static str {
"sort"
}
}
impl JoshutoCommand for Sort {}
impl std::fmt::Display for Sort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(Self::command())
}
}
impl JoshutoRunnable for Sort {
fn execute(&self, context: &mut JoshutoContext, backend: &mut TuiBackend) -> JoshutoResult<()> {
context.config_t.sort_option.sort_method = self.sort_method;
Ok(())
}
}
|