Compare commits
No commits in common. "b322c0307de7940cfdda8c4152e5152729cd125e" and "d614d678af77231d7bf25336a1afd00ad7757ab7" have entirely different histories.
b322c0307d
...
d614d678af
4 changed files with 11 additions and 80 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "streamd"
|
||||
version = "0.2.1"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
description = "Personal knowledge management and time-tracking CLI using @Tag annotations"
|
||||
license = "AGPL-3.0-only"
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ pub enum Commands {
|
|||
/// Display time as minutes (HH:MM) instead of decimal hours (H.Hh)
|
||||
#[arg(short, long)]
|
||||
minutes: bool,
|
||||
|
||||
/// Show all timecards grouped by day instead of the summary report
|
||||
#[arg(short, long)]
|
||||
debug: bool,
|
||||
},
|
||||
|
||||
/// Generate shell completions
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
use chrono::Datelike;
|
||||
use chrono::NaiveDate;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
use crate::config::Settings;
|
||||
|
|
@ -13,7 +11,7 @@ const COLUMN_SEPARATOR_WIDTH: usize = 65;
|
|||
use crate::error::StreamdError;
|
||||
use crate::extract::parse_markdown_file;
|
||||
use crate::localize::localize_stream_file;
|
||||
use crate::models::{LocalizedShard, Timesheet};
|
||||
use crate::models::LocalizedShard;
|
||||
use crate::timesheet::{
|
||||
extract_timesheets, generate_report, load_repository_config, BasicTimesheetConfiguration,
|
||||
DayType, DayWarning, MonthReport, TimesheetReport,
|
||||
|
|
@ -239,65 +237,7 @@ fn print_warnings(report: &TimesheetReport, use_minutes: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Print debug view: all timecards grouped and sorted by day.
|
||||
fn print_debug(report: &TimesheetReport, timesheets: &[Timesheet]) {
|
||||
let timesheets_by_date: HashMap<NaiveDate, &Timesheet> =
|
||||
timesheets.iter().map(|ts| (ts.date, ts)).collect();
|
||||
|
||||
for month in &report.months {
|
||||
let month_title = format!("{} {}", month.month_name(), month.year);
|
||||
let separator = "\u{2550}".repeat(SEPARATOR_WIDTH);
|
||||
println!("{}", separator);
|
||||
println!(" {}", month_title);
|
||||
println!("{}", separator);
|
||||
println!();
|
||||
|
||||
for day in &month.days {
|
||||
let date_str = day.date.format("%Y-%m-%d").to_string();
|
||||
let weekday = weekday_abbrev(day.date);
|
||||
|
||||
let mut parts: Vec<String> = Vec::new();
|
||||
|
||||
// Add day type label for non-regular days
|
||||
let type_label = match day.day_type {
|
||||
DayType::Regular => None,
|
||||
DayType::SickLeave => Some("Sick Leave"),
|
||||
DayType::Vacation => Some("Vacation"),
|
||||
DayType::Holiday => Some("Holiday"),
|
||||
DayType::FlexDay => Some("Flex Day"),
|
||||
DayType::Weekend => Some("Weekend"),
|
||||
DayType::Missing => Some("Missing"),
|
||||
DayType::OutsidePeriod => Some("Outside Period"),
|
||||
};
|
||||
if let Some(label) = type_label {
|
||||
parts.push(label.to_string());
|
||||
}
|
||||
|
||||
// Add timecards
|
||||
if let Some(ts) = timesheets_by_date.get(&day.date) {
|
||||
for tc in &ts.timecards {
|
||||
parts.push(format!(
|
||||
"{} - {}",
|
||||
tc.from_time.format("%H:%M"),
|
||||
tc.to_time.format("%H:%M")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
let content = if parts.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
parts.join(", ")
|
||||
};
|
||||
|
||||
println!(" {} ({}): {}", date_str, weekday, content);
|
||||
}
|
||||
|
||||
println!();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(use_minutes: bool, debug: bool) -> Result<(), StreamdError> {
|
||||
pub fn run(use_minutes: bool) -> Result<(), StreamdError> {
|
||||
let settings = Settings::load()?;
|
||||
let base_folder = Path::new(&settings.base_folder);
|
||||
|
||||
|
|
@ -333,19 +273,16 @@ pub fn run(use_minutes: bool, debug: bool) -> Result<(), StreamdError> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
if debug {
|
||||
print_debug(&report, ×heets);
|
||||
} else {
|
||||
print_header();
|
||||
// Print the report
|
||||
print_header();
|
||||
|
||||
for month in &report.months {
|
||||
print_month(month, use_minutes);
|
||||
}
|
||||
|
||||
print_cumulative_balance(report.cumulative_balance, use_minutes);
|
||||
print_warnings(&report, use_minutes);
|
||||
for month in &report.months {
|
||||
print_month(month, use_minutes);
|
||||
}
|
||||
|
||||
print_cumulative_balance(report.cumulative_balance, use_minutes);
|
||||
print_warnings(&report, use_minutes);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ fn main() -> miette::Result<()> {
|
|||
Some(TodoAction::Done { number }) => streamd::cli::commands::todo::run_done(number)?,
|
||||
},
|
||||
Some(Commands::Edit { number }) => streamd::cli::commands::edit::run(number)?,
|
||||
Some(Commands::Timesheet { minutes, debug }) => {
|
||||
streamd::cli::commands::timesheet::run(minutes, debug)?
|
||||
}
|
||||
Some(Commands::Timesheet { minutes }) => streamd::cli::commands::timesheet::run(minutes)?,
|
||||
Some(Commands::Completions { shell }) => {
|
||||
streamd::cli::commands::completions::run(shell);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue