Skip to content

Commit

Permalink
[ui] also output id of time entry
Browse files Browse the repository at this point in the history
  • Loading branch information
icepuma committed Dec 1, 2021
1 parent 86ea998 commit 4268113
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/commands/time_entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use term_table::{
};

struct OutputEntry {
id: u64,
date: NaiveDate,
duration: Duration,
workspace: String,
Expand Down Expand Up @@ -97,6 +98,7 @@ fn collect_output_entries(
};

output_entries.push(OutputEntry {
id: entry.id,
date: entry.start.date().naive_local(),
duration,
workspace: maybe_workspace
Expand Down Expand Up @@ -338,9 +340,10 @@ fn output_values_raw(output_entries: &[OutputEntry]) {
};

println!(
"{}\t{}\t{}\t{}\t{}\t{}\t{}",
"{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}",
&entry.date,
duration_text,
&entry.id,
&entry.workspace,
&entry.project,
&entry.client,
Expand Down Expand Up @@ -370,6 +373,7 @@ fn output_values_table(output_entries: &[OutputEntry]) {
let header = Row::new(vec![
TableCell::new("Date".bold().underline()),
TableCell::new("Time".bold().underline()),
TableCell::new("Id".bold().underline()),
TableCell::new("Workspace".bold().underline()),
TableCell::new("Project".bold().underline()),
TableCell::new("Customer".bold().underline()),
Expand All @@ -387,6 +391,7 @@ fn output_values_table(output_entries: &[OutputEntry]) {
TableCell::new(""),
TableCell::new(""),
TableCell::new(""),
TableCell::new(""),
]));

let mut total_time_sum = 0;
Expand All @@ -405,6 +410,7 @@ fn output_values_table(output_entries: &[OutputEntry]) {
TableCell::new(""),
TableCell::new(""),
TableCell::new(""),
TableCell::new(""),
]);

table.add_row(date_row);
Expand All @@ -419,6 +425,7 @@ fn output_values_table(output_entries: &[OutputEntry]) {
let entry_row = Row::new(vec![
TableCell::new(""),
TableCell::new(duration_text),
TableCell::new(&entry.id),
TableCell::new(&entry.workspace),
TableCell::new(&entry.project),
TableCell::new(&entry.client),
Expand Down

0 comments on commit 4268113

Please sign in to comment.