From 591ae8f796e918edcb2c1980231184f06957bf56 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 21 May 2023 22:37:06 -0500 Subject: [PATCH] fix: Remember choice if cancelled by user --- src/functions.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index de001c6..3804808 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -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); } };