blob: f466ca7236d932c0357aaceb325c5f966b70117d (
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
|
use crate::commands::{JoshutoCommand, JoshutoRunnable};
use crate::context::JoshutoContext;
use crate::error::JoshutoResult;
use crate::window::JoshutoView;
use super::local_state::{FileOp, LocalState};
#[derive(Clone, Debug)]
pub struct CutFiles;
impl CutFiles {
pub fn new() -> Self {
CutFiles
}
pub const fn command() -> &'static str {
"cut_files"
}
}
impl JoshutoCommand for CutFiles {}
impl std::fmt::Display for CutFiles {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(Self::command())
}
}
impl JoshutoRunnable for CutFiles {
fn execute(&self, context: &mut JoshutoContext, _: &JoshutoView) -> JoshutoResult<()> {
let curr_tab = context.curr_tab_ref();
LocalState::repopulated_selected_files(&curr_tab.curr_list)?;
LocalState::set_file_op(FileOp::Cut);
LocalState::set_tab_src(context.curr_tab_index);
Ok(())
}
}
|