add temporary limitation for managers subcommands

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-05 12:39:19 +03:00
parent 972aae9460
commit 92e4ae4dc2
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -40,6 +40,10 @@ fn main() {
link, link,
no_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() { if idx == 0 || idx > tasks.len() {
panic!("invalid index"); panic!("invalid index");
} }
@ -61,6 +65,10 @@ fn main() {
println!("changed"); println!("changed");
} }
cli::SubCommand::Remove { idx } => { 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() { if idx == 0 || idx > tasks.len() {
panic!("invalid index"); panic!("invalid index");
} }
@ -110,6 +118,10 @@ fn main() {
idx: target_idx, idx: target_idx,
priority, 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() { if target_idx == 0 || target_idx > tasks.len() {
panic!("invalid index"); panic!("invalid index");
} }