Skip to content

Commit

Permalink
Added history counts to dupe output.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Dec 21, 2023
1 parent ca3de0c commit 5999661
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions rucksack/src/command/handlers/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ fn extract_results(
result.add(Column::Category, md.category.clone());
result.add(Column::Count, md.access_count.to_string());
result.add(Column::Status, md.status().to_string());
result.add(Column::HistoryCount, format!("{:}", record.history().len()));
match opts.decrypted {
true => {
let pwd = if opts.reveal {
Expand Down
16 changes: 9 additions & 7 deletions rucksack/src/output/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub enum Column {
Created,
DupeInfo,
Hash,
HistoryCount,
Id,
Imported,
Key,
Expand Down Expand Up @@ -39,6 +40,7 @@ impl Column {
match self {
Column::Count => "Access Count".to_string(),
Column::DupeInfo => "Duplicate Info".to_string(),
Column::HistoryCount => "History Count".to_string(),
Column::Kind => "Type".to_string(),
Column::LastUpdated => "Last Updated".to_string(),
Column::Score => "Score / Strength".to_string(),
Expand Down Expand Up @@ -138,20 +140,20 @@ impl Columns for ColsGroupByName {
}
}

#[derive(Eq, PartialEq, PartialOrd)]
pub struct ColsGroupByHash;

impl Columns for ColsGroupByHash {
fn pre(&self, _opts: &Opts) -> Vec<Column> {
vec![
Column::Name,
Column::Kind,
Column::Category,
Column::DupeInfo,
]
vec![Column::Kind, Column::Category, Column::DupeInfo]
}

fn post(&self, _opts: &Opts, mut cols: Vec<Column>) -> Vec<Column> {
cols.append(&mut vec![Column::Count, Column::LastUpdated, Column::Url]);
cols.append(&mut vec![
Column::Count,
Column::LastUpdated,
Column::HistoryCount,
]);
cols
}
}
Expand Down

0 comments on commit 5999661

Please sign in to comment.