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

View file

@ -1,6 +1,6 @@
use inquire::{ use inquire::{
ui::{Color, IndexPrefix, RenderConfig, Styled}, ui::{Color, IndexPrefix, RenderConfig, Styled},
Select, InquireError, Select,
}; };
use std::{collections::HashMap, fs, path::Path, process::exit}; use std::{collections::HashMap, fs, path::Path, process::exit};
use tmdb_api::{ use tmdb_api::{
@ -137,7 +137,11 @@ pub async fn process_file(
Ok(movie) => movie, Ok(movie) => movie,
Err(error) => { Err(error) => {
println!(" {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);
} }
}; };