summaryrefslogtreecommitdiffstats
path: root/src/key_command/impl_display.rs
blob: 05b7206ccdb76d472aa5745f9f2a50aa2803d011 (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
use super::{AppCommand, Command};

impl std::fmt::Display for Command {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            Self::ChangeDirectory { path } => write!(f, "{} {:?}", self.command(), path),
            Self::CommandLine { prefix, suffix } => {
                write!(f, "{} {} || {}", self.command(), prefix, suffix)
            }
            Self::CursorMoveUp { offset } => write!(f, "{} {}", self.command(), offset),
            Self::CursorMoveDown { offset } => write!(f, "{} {}", self.command(), offset),

            Self::ParentCursorMoveUp { offset } => write!(f, "{} {}", self.command(), offset),
            Self::ParentCursorMoveDown { offset } => write!(f, "{} {}", self.command(), offset),

            Self::PreviewCursorMoveUp { offset } => write!(f, "{} {}", self.command(), offset),
            Self::PreviewCursorMoveDown { offset } => write!(f, "{} {}", self.command(), offset),

            Self::NewDirectory { path } => write!(f, "{} {:?}", self.command(), path),

            Self::SymlinkFiles { relative } => {
                write!(f, "{} --relative={}", self.command(), relative)
            }
            Self::PasteFiles { options } => write!(f, "{}  {}", self.command(), options),
            Self::DeleteFiles { background: false } => {
                write!(f, "{} --foreground=true", self.command(),)
            }

            Self::RenameFile { new_name } => write!(f, "{} {:?}", self.command(), new_name),

            Self::SearchGlob { pattern } => write!(f, "{} {}", self.command(), pattern),
            Self::SearchString { pattern } => write!(f, "{} {}", self.command(), pattern),
            Self::SelectFiles { pattern, options } => {
                write!(f, "{} {} {}", self.command(), pattern, options)
            }
            Self::SubProcess { words, .. } => write!(f, "{} {:?}", self.command(), words),
            Self::Sort(t) => write!(f, "{} {}", self.command(), t),
            Self::TabSwitch { offset } => write!(f, "{} {}", self.command(), offset),
            Self::TabSwitchIndex { index } => write!(f, "{} {}", self.command(), index),
            _ => write!(f, "{}", self.command()),
        }
    }
}