fix: Fix missing imports and type resolution issues
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
use crate::Alignment;
|
||||
|
||||
use crate::db::{get_item, get_item_last, get_items, get_items_matching, Item, Meta, Tag};
|
||||
use crate::db::{
|
||||
get_item, get_item_last, get_items, get_items_matching, get_item_tags, get_item_meta, Item, Meta, Tag,
|
||||
};
|
||||
use crate::modes::common::{
|
||||
format_size, get_format_box_chars_no_border_line_separator, ColumnType,
|
||||
};
|
||||
@@ -11,13 +13,13 @@ use prettytable::{Attr, Cell, Row, Table};
|
||||
use rusqlite::Connection;
|
||||
|
||||
pub fn mode_list(
|
||||
cmd: &mut Command,
|
||||
cmd: &mut clap::Command,
|
||||
args: crate::Args,
|
||||
ids: &mut Vec<i64>,
|
||||
tags: &Vec<String>,
|
||||
conn: &mut Connection,
|
||||
data_path: PathBuf,
|
||||
) -> Result<()> {
|
||||
conn: &mut rusqlite::Connection,
|
||||
data_path: std::path::PathBuf,
|
||||
) -> anyhow::Result<()> {
|
||||
if !ids.is_empty() {
|
||||
cmd.error(
|
||||
ErrorKind::InvalidInput,
|
||||
@@ -26,7 +28,7 @@ pub fn mode_list(
|
||||
.exit();
|
||||
}
|
||||
|
||||
let mut meta: HashMap<String, String> = HashMap::new();
|
||||
let mut meta: std::collections::HashMap<String, String> = std::collections::HashMap::new();
|
||||
for item in args.item.meta.iter() {
|
||||
let item = item.clone();
|
||||
meta.insert(item.key, item.value);
|
||||
@@ -39,28 +41,28 @@ pub fn mode_list(
|
||||
|
||||
debug!("MAIN: Items: {:?}", items);
|
||||
|
||||
let mut tags_by_item: HashMap<i64, Vec<String>> = HashMap::new();
|
||||
let mut meta_by_item: HashMap<i64, HashMap<String, String>> = HashMap::new();
|
||||
let mut tags_by_item: std::collections::HashMap<i64, Vec<String>> = std::collections::HashMap::new();
|
||||
let mut meta_by_item: std::collections::HashMap<i64, std::collections::HashMap<String, String>> = std::collections::HashMap::new();
|
||||
|
||||
for item in items.iter() {
|
||||
let item_id = item.id.unwrap();
|
||||
|
||||
let item_tags: Vec<String> = get_item_tags(conn, item)?
|
||||
let item_tags: Vec<String> = crate::db::get_item_tags(conn, item)?
|
||||
.into_iter()
|
||||
.map(|x| x.name)
|
||||
.collect();
|
||||
tags_by_item.insert(item_id, item_tags);
|
||||
|
||||
let mut item_meta: HashMap<String, String> = HashMap::new();
|
||||
let mut item_meta: std::collections::HashMap<String, String> = std::collections::HashMap::new();
|
||||
|
||||
for meta in get_item_meta(conn, item)? {
|
||||
for meta in crate::db::get_item_meta(conn, item)? {
|
||||
item_meta.insert(meta.name.clone(), meta.value);
|
||||
}
|
||||
meta_by_item.insert(item_id, item_meta);
|
||||
}
|
||||
|
||||
let mut table = Table::new();
|
||||
table.set_format(*consts::FORMAT_CLEAN);
|
||||
table.set_format(*format::consts::FORMAT_CLEAN);
|
||||
|
||||
let list_format = args.options.list_format.split(",");
|
||||
|
||||
@@ -116,7 +118,7 @@ pub fn mode_list(
|
||||
Alignment::RIGHT,
|
||||
),
|
||||
ColumnType::Time => Cell::new(&string_column(
|
||||
item.ts.with_timezone(&Local).format("%F %T").to_string(),
|
||||
item.ts.with_timezone(&chrono::Local).format("%F %T").to_string(),
|
||||
column_width,
|
||||
)),
|
||||
ColumnType::Size => match item.size {
|
||||
|
||||
Reference in New Issue
Block a user