1use clap::Args;
2use std::{ffi::OsString, fmt::Display, ops::Deref, path::PathBuf};
3
4#[derive(Debug, Args, Clone, Default)]
6pub struct CsvModeOptions {
7 pub session_id: String,
9
10 #[arg(short, long, default_value_t)]
12 pub sessions_path: SessionsPath,
13
14 #[arg(short, long, default_value_t)]
16 pub events_path: EventsPath,
17}
18
19#[derive(Debug, Clone)]
23pub struct SessionsPath(pub PathBuf);
24
25impl Default for SessionsPath {
26 fn default() -> Self {
27 Self(PathBuf::from("sessions.csv"))
28 }
29}
30
31impl Display for SessionsPath {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 write!(f, "{}", self.0.display())
34 }
35}
36
37impl From<OsString> for SessionsPath {
38 fn from(value: OsString) -> Self {
39 Self(PathBuf::from(value))
40 }
41}
42
43impl Deref for SessionsPath {
44 type Target = PathBuf;
45
46 fn deref(&self) -> &Self::Target {
47 &self.0
48 }
49}
50
51#[derive(Debug, Clone)]
55pub struct EventsPath(pub PathBuf);
56
57impl Default for EventsPath {
58 fn default() -> Self {
59 Self(PathBuf::from("events.csv"))
60 }
61}
62
63impl Display for EventsPath {
64 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
65 write!(f, "{}", self.0.display())
66 }
67}
68
69impl From<OsString> for EventsPath {
70 fn from(value: OsString) -> Self {
71 Self(PathBuf::from(value))
72 }
73}
74
75impl Deref for EventsPath {
76 type Target = PathBuf;
77
78 fn deref(&self) -> &Self::Target {
79 &self.0
80 }
81}