fm/modes/utils/
second_line.rs

1use crate::modes::{InputCompleted, InputSimple, MarkAction, Menu, Navigate, NeedConfirmation};
2
3/// Line describing the mode and its custom keybinds
4pub trait SecondLine {
5    /// Line describing the mode and its custom keybinds
6    fn second_line(&self) -> &'static str;
7}
8
9impl SecondLine for Menu {
10    fn second_line(&self) -> &'static str {
11        match self {
12            Self::Navigate(navigate) => navigate.second_line(),
13            Self::InputSimple(input_simple) => input_simple.second_line(),
14            Self::NeedConfirmation(need_confirmation) => need_confirmation.second_line(),
15            Self::InputCompleted(input_completed) => input_completed.second_line(),
16            Self::Nothing => "",
17        }
18    }
19}
20
21impl SecondLine for Navigate {
22    fn second_line(&self) -> &'static str {
23        match self {
24            Self::Trash => "Trash. Select an element to be restored or deleted.",
25            Self::History => "Pick a destination",
26            Self::Shortcut => "Pick a destination",
27            Self::Compress => "Archive and compress the flagged files using selected algorithm.",
28            Self::Marks(mark_action) => mark_action.second_line(),
29            Self::TempMarks(mark_action) => mark_action.second_line(),
30            Self::Mount => "Symbols: M: mounted, U: not mounted, C: encrypted, R: removable, P: mtp device, L: loop device (iso)",
31            Self::Context => "Pick an action",
32            Self::TuiApplication => "Pick a command",
33            Self::CliApplication => "Pick a command",
34            Self::Cloud => "Remote navigation",
35            Self::Picker => "Pick an item",
36            Self::Flagged => "Pick a file",
37        }
38    }
39}
40
41impl SecondLine for MarkAction {
42    fn second_line(&self) -> &'static str {
43        match self {
44            Self::Jump => "Select a mark to go to or type its symbol. <Backspace> erases the mark",
45            Self::New => "Select a mark or type its char to update it. <Backspace> erases mark",
46        }
47    }
48}
49
50impl SecondLine for InputCompleted {
51    fn second_line(&self) -> &'static str {
52        match self {
53            Self::Cd => "Type your destination",
54            Self::Search => "Type a pattern to search",
55            Self::Exec => "Type a program",
56            Self::Action => "Type an fm action",
57        }
58    }
59}
60
61impl SecondLine for InputSimple {
62    fn second_line(&self) -> &'static str {
63        ""
64    }
65}
66
67impl SecondLine for NeedConfirmation {
68    fn second_line(&self) -> &'static str {
69        ""
70    }
71}