fix: Gracefully exit after user cancellation

This commit is contained in:
Sayantan Santra 2023-05-21 16:47:06 -05:00
parent 02fea4a71c
commit 4d04f51251
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
1 changed files with 8 additions and 2 deletions

View File

@ -95,12 +95,18 @@ pub async fn process_file(
} }
// Choose from the possible entries // Choose from the possible entries
let choice = Select::new( let choice = match Select::new(
format!(" Possible choices for {}:", file_base).as_str(), format!(" Possible choices for {}:", file_base).as_str(),
movie_list, movie_list,
) )
.prompt() .prompt()
.expect(" Invalid choice!"); {
Ok(movie) => movie,
Err(error) => {
println!(" {error}");
return ("".to_string(), true);
}
};
// Handle the case for subtitle files // Handle the case for subtitle files
let mut is_subtitle = false; let mut is_subtitle = false;