summaryrefslogtreecommitdiffstats
path: root/src/op.rs
diff options
context:
space:
mode:
authorkyoheiu <kyoheiu@outlook.com>2022-05-21 06:03:59 +0900
committerkyoheiu <kyoheiu@outlook.com>2022-05-21 06:03:59 +0900
commit020073188559973787de5b213a5d380a9c32cf87 (patch)
treed55e89832833d7f8af5a11b066a5b38211bb4434 /src/op.rs
parentc0d97fe951b445e07893dd56d1b0f30ae2f9b7aa (diff)
Implement logging of undo/redo
Diffstat (limited to 'src/op.rs')
-rw-r--r--src/op.rs22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/op.rs b/src/op.rs
index 5e5d698..57f8111 100644
--- a/src/op.rs
+++ b/src/op.rs
@@ -76,10 +76,30 @@ fn log(op: &OpKind) {
info!("{}", result);
}
+pub fn relog(op: &OpKind, undo: bool) {
+ let mut result = if undo {
+ "UNDO: ".to_string()
+ } else {
+ "REDO: ".to_string()
+ };
+ match op {
+ OpKind::Put(_) => {
+ result.push_str("PUT");
+ }
+ OpKind::Delete(_) => {
+ result.push_str("DELETE");
+ }
+ OpKind::Rename(_) => {
+ result.push_str("RENAME");
+ }
+ }
+ info!("{}", result);
+}
+
fn item_to_string(v: &Vec<ItemInfo>) -> String {
let mut result = String::new();
for p in v {
- result.push_str(&p.file_name);
+ result.push_str(p.file_path.as_path().to_str().unwrap());
result.push(' ');
}
result