1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! Display recorded breaks and pauses command.
//!
//! Provides detailed views of automatically detected and manually recorded breaks during work sessions.
//!
//! ## Features
//!
//! - **Break Analysis**: View all recorded pauses and their durations
//! - **Date Filtering**: Show breaks for specific dates or today
//! - **Duration Thresholds**: Filter out short interruptions using configurable thresholds
//! - **Pattern Recognition**: Understand break patterns and timing
//! - **Verification Tool**: Validate automatic pause detection accuracy
//!
//! ## Usage
//!
//! ```bash
//! # Show today's pauses
//! kasl pauses today
//!
//! # Show pauses for specific date
//! kasl pauses 2025-01-15
//! ```
use cratePauses;
use crateWorkdays;
use crateConfig;
use crateMessage;
use crateView;
use cratemsg_print;
use Result;
use ;
use Args;
/// Command-line arguments for the pauses command.
///
/// This command allows users to view breaks for any date with optional
/// filtering by duration to focus on significant pauses.
/// Executes the pauses command to display breaks for a given date.
///
/// Retrieves and displays pause records from the database, applying duration
/// filtering and presenting the results in a formatted table.
///
/// # Arguments
///
/// * `args` - Parsed command-line arguments containing date and filter options
///
/// # Returns
///
/// Returns `Ok(())` on successful display, or an error if date parsing fails
/// or database operations encounter issues.
///
/// # Error Scenarios
///
/// - Invalid date format in `--date` argument
/// - Database connection failures
/// - Configuration file read errors
/// - Permission issues accessing pause records
pub async
/// Parses a date string into a structured date value.
///
/// This helper function handles both the special 'today' keyword and
/// explicit date strings in ISO format (YYYY-MM-DD). It provides
/// user-friendly date input parsing with clear error messages.
///
/// # Arguments
///
/// * `date_str` - The date string to parse, either 'today' or 'YYYY-MM-DD'
///
/// # Returns
///
/// Returns the parsed `NaiveDate` on success, or an error if the date
/// string is invalid or unparseable.
///
/// # Supported Formats
///
/// - `today` (case-insensitive) - Returns current local date
/// - `YYYY-MM-DD` - ISO 8601 date format (e.g., `2025-01-15`)
///
/// # Examples
///
/// ```rust
/// let today = parse_date("today")?;
/// let specific = parse_date("2025-12-25")?;
/// ```
///
/// # Error Cases
///
/// - Malformed date strings (e.g., `2025-13-45`)
/// - Invalid date formats (e.g., `01/15/2025`)
/// - Non-existent dates (e.g., `2025-02-30`)