From 72af6bfd619586bb8b032fb65706473e15261034 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 23 Jul 2024 23:04:55 +0300 Subject: [PATCH] feat: enable removing column by index --- src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f62f123..c157638 100644 --- a/src/main.rs +++ b/src/main.rs @@ -104,7 +104,12 @@ async fn main() { Some(':') => match input[1..2].parse::() { Ok(index) => { - tasks.properties.insert(index, input[2..].to_string()); + let value = input[2..].to_string(); + if tasks.properties.get(index) == Some(&value) { + tasks.properties.remove(index); + } else { + tasks.properties.insert(index, value); + } } Err(_) => { let prop = &input[1..];