From 92e4ae4dc26881001ac06a2fcb7987f31f2e04c0 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 5 Aug 2022 12:39:19 +0300 Subject: [PATCH] add temporary limitation for managers subcommands --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.rs b/src/main.rs index 26db63c..557992f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,10 @@ fn main() { link, no_link, } => { + if current_task_info.is_some() { + panic!("You can change priority only when you don't have an active task, yet"); + } + if idx == 0 || idx > tasks.len() { panic!("invalid index"); } @@ -61,6 +65,10 @@ fn main() { println!("changed"); } cli::SubCommand::Remove { idx } => { + if current_task_info.is_some() { + panic!("You can change priority only when you don't have an active task, yet"); + } + if idx == 0 || idx > tasks.len() { panic!("invalid index"); } @@ -110,6 +118,10 @@ fn main() { idx: target_idx, priority, } => { + if current_task_info.is_some() { + panic!("You can change priority only when you don't have an active task, yet"); + } + if target_idx == 0 || target_idx > tasks.len() { panic!("invalid index"); }