summaryrefslogtreecommitdiffstats
path: root/src/mode.rs
diff options
context:
space:
mode:
authorqkzk <qu3nt1n@gmail.com>2023-09-23 14:42:08 +0200
committerqkzk <qu3nt1n@gmail.com>2023-09-23 14:42:08 +0200
commiteee6d1a8835d51d929b29da83c7466bc32f5029a (patch)
tree1271014c92c41a6853d45f6a8a6f899d0f4afda9 /src/mode.rs
parent5ea0739aeec461d1d4365806c7280e350558bd9f (diff)
Needconfirmation mode are responsible of their confirmation message
Diffstat (limited to 'src/mode.rs')
-rw-r--r--src/mode.rs15
1 files changed, 15 insertions, 0 deletions
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 {