Add an option to delete only empty albums

This commit is contained in:
Marc Plano-Lesay 2024-12-03 19:09:07 +11:00
parent 0ac02c34c6
commit 776c9b005f
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
3 changed files with 10 additions and 4 deletions

View file

@ -10,8 +10,10 @@ use crate::{
use color_eyre::eyre::Result;
use log::info;
pub async fn delete_albums(ctx: Context) -> Result<()> {
let albums = FetchAllAlbums::new(()).execute(&ctx).await?;
pub async fn delete_albums(ctx: Context, empty: bool) -> Result<()> {
let mut albums = FetchAllAlbums::new(()).execute(&ctx).await?;
albums.retain(|album| !empty || album.assets_count == 0);
if let ConfirmResult::Positive = Confirm::new(None).execute(&ctx).await? {
for album in &albums {