fix: Fix missing imports and type resolution issues

This commit is contained in:
Andrew Phillips (aider)
2025-05-10 13:51:11 -03:00
parent 0a8464bab3
commit c2ace42c02
2 changed files with 19 additions and 31 deletions

View File

@@ -1,9 +1,10 @@
use humansize::{FormatSizeOptions, BINARY};
use log::debug;
use log::{debug, self};
use prettytable::format::TableFormat; // Add missing import
use regex::Regex;
use std::collections::HashMap;
use std::env;
use anyhow::anyhow;
pub fn get_meta_from_env() -> HashMap<String, String> {
debug!("MAIN: Getting meta from KEEP_META_*");
@@ -80,23 +81,8 @@ impl ColumnType {
}
}
impl TryFrom<&str> for ColumnType {
type Error = anyhow::Error;
fn try_from(s: &str) -> Result<Self, Self::Error> {
match s {
"id" => Ok(ColumnType::Id),
"time" => Ok(ColumnType::Time),
"size" => Ok(ColumnType::Size),
"compression" => Ok(ColumnType::Compression),
"filesize" => Ok(ColumnType::FileSize),
"filepath" => Ok(ColumnType::FilePath),
"tags" => Ok(ColumnType::Tags),
"meta" => Ok(ColumnType::Meta),
_ => Err(anyhow!("Unknown column type: {}", s)),
}
}
}
// impl TryFrom<&str> for ColumnType is already implemented by strum_macros
// so we remove this conflicting implementation
pub fn get_format_box_chars_no_border_line_separator() -> TableFormat {
prettytable::format::FormatBuilder::new()