summaryrefslogtreecommitdiffstats
path: root/src/event_char.rs
blob: 7f48d5cf44a72eb48e829e7287e801a5ce4e64f9 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crate::status::Status;

pub enum EventChar {
    ToggleHidden,
    CopyPaste,
    CutPaste,
    NewDir,
    NewFile,
    Chmod,
    Exec,
    Goto,
    Rename,
    ClearFlags,
    ToggleFlag,
    Shell,
    DeleteFile,
    OpenFile,
    Help,
    Search,
    RegexMatch,
    Quit,
    FlagAll,
    ReverseFlags,
    Jump,
    NvimFilepicker,
    Sort,
    Symlink,
}

impl EventChar {
    pub fn match_char(&self, status: &mut Status) {
        match *self {
            EventChar::ToggleHidden => status.event_toggle_hidden(),
            EventChar::CopyPaste => status.event_copy_paste(),
            EventChar::CutPaste => status.event_cur_paste(),
            EventChar::NewDir => status.event_new_dir(),
            EventChar::NewFile => status.event_new_file(),
            EventChar::Chmod => status.event_chmod(),
            EventChar::Exec => status.event_exec(),
            EventChar::Goto => status.event_goto(),
            EventChar::Rename => status.event_rename(),
            EventChar::ClearFlags => status.event_clear_flags(),
            EventChar::ToggleFlag => status.event_toggle_flag(),
            EventChar::Shell => status.event_shell(),
            EventChar::DeleteFile => status.event_delete_file(),
            EventChar::OpenFile => status.event_open_file(),
            EventChar::Help => status.event_help(),
            EventChar::Search => status.event_search(),
            EventChar::RegexMatch => status.event_regex_match(),
            EventChar::Quit => status.event_quit(),
            EventChar::FlagAll => status.event_flag_all(),
            EventChar::ReverseFlags => status.event_reverse_flags(),
            EventChar::Jump => status.event_jump(),
            EventChar::NvimFilepicker => status.event_nvim_filepicker(),
            EventChar::Sort => status.event_sort(),
            EventChar::Symlink => status.event_symlink(),
        }
    }
}