From eee6d1a8835d51d929b29da83c7466bc32f5029a Mon Sep 17 00:00:00 2001 From: qkzk Date: Sat, 23 Sep 2023 14:42:08 +0200 Subject: Needconfirmation mode are responsible of their confirmation message --- src/mode.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mode.rs') diff --git a/src/mode.rs b/src/mode.rs index 012f0a2..38cfa70 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -41,6 +41,21 @@ impl NeedConfirmation { Self::EmptyTrash => 35, } } + + /// A confirmation message to be displayed before executing the mode. + /// When files are moved or copied the destination is displayed. + pub fn confirmation_string(&self, destination: &str) -> String { + match *self { + NeedConfirmation::Copy => { + format!("Files will be copied to {}", destination) + } + NeedConfirmation::Delete => "Files will deleted permanently".to_owned(), + NeedConfirmation::Move => { + format!("Files will be moved to {}", destination) + } + NeedConfirmation::EmptyTrash => "Trash will be emptied".to_owned(), + } + } } impl std::fmt::Display for NeedConfirmation { -- cgit v1.2.3