style: reorder imports and reformat code for consistency

This commit is contained in:
Andrew Phillips
2025-05-10 10:06:33 -03:00
committed by Andrew Phillips (aider)
parent c936326ac3
commit 9feec61759
13 changed files with 492 additions and 356 deletions

View File

@@ -1,11 +1,11 @@
use anyhow::{Context, Result, anyhow};
use anyhow::{anyhow, Context, Result};
use std::fs;
use std::path::PathBuf;
use crate::db;
use clap::error::ErrorKind;
use clap::Command;
use log::{debug, warn};
use clap::error::ErrorKind;
use rusqlite::Connection;
pub fn mode_delete(
@@ -17,9 +17,17 @@ pub fn mode_delete(
data_path: PathBuf,
) -> Result<()> {
if ids.is_empty() {
cmd.error(ErrorKind::InvalidValue, "No ID given, you must supply atleast one ID when using --delete").exit();
} else if ! tags.is_empty() {
cmd.error(ErrorKind::InvalidValue, "Tags given but not supported, you must supply atleast one ID when using --delete").exit();
cmd.error(
ErrorKind::InvalidValue,
"No ID given, you must supply atleast one ID when using --delete",
)
.exit();
} else if !tags.is_empty() {
cmd.error(
ErrorKind::InvalidValue,
"Tags given but not supported, you must supply atleast one ID when using --delete",
)
.exit();
}
for item_id in ids.iter() {
@@ -30,7 +38,8 @@ pub fn mode_delete(
let mut item_path = data_path.clone();
item_path.push(item_id.to_string());
fs::remove_file(&item_path).context(anyhow!("Unable to remove item file {:?}", item_path))?;
fs::remove_file(&item_path)
.context(anyhow!("Unable to remove item file {:?}", item_path))?;
} else {
warn!("Unable to find item {item_id} in database");
}