fix: Remember choice if cancelled by user

This commit is contained in:
Sayantan Santra 2023-05-21 22:37:06 -05:00
parent 8b6e83a55a
commit 591ae8f796
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use inquire::{
ui::{Color, IndexPrefix, RenderConfig, Styled},
Select,
InquireError, Select,
};
use std::{collections::HashMap, fs, path::Path, process::exit};
use tmdb_api::{
@ -137,7 +137,11 @@ pub async fn process_file(
Ok(movie) => movie,
Err(error) => {
println!(" {error}");
return (filename_without_ext, "".to_string(), false);
let flag = matches!(
error,
InquireError::OperationCanceled | InquireError::OperationInterrupted
);
return (filename_without_ext, "".to_string(), flag);
}
};