Skip to content

Commit

Permalink
change the print format to be less retarded/more parseable
Browse files Browse the repository at this point in the history
  • Loading branch information
AnneKitsune committed Mar 4, 2020
1 parent 2bf1d9f commit 23aba24
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ pub fn print_item_instances(instances: &Vec<&ItemInstance>, inv: &Inventory, min
let mut table = Table::new();
table.add_row(row![
"id",
"(id)item type",
"type id",
"type name",
"quantity",
"model",
"serial",
Expand All @@ -413,18 +414,15 @@ pub fn print_item_instances(instances: &Vec<&ItemInstance>, inv: &Inventory, min
"expires at"
]);
instances.iter().for_each(|t| {
let item_type_str = format!(
"({}){}",
t.item_type.to_string(),
inv.item_types
let item_type_str = inv.item_types
.iter()
.find(|ty| ty.id == t.item_type)
.expect("Failed to find item type for item instance")
.name
)
.to_string();
.to_string();
table.add_row(row![
t.id.to_string(),
t.item_type.to_string(),
item_type_str,
t.quantity.to_string(),
conv(&t.model),
Expand Down

0 comments on commit 23aba24

Please sign in to comment.