, arg1: String) {
@@ -768,7 +517,7 @@ fn read_lines(filename: P) -> io::Result>>
Ok(io::BufReader::new(file).lines())
}
-fn add_event(events: &mut Vec, arg1: String, arg2: String, arg3: String, arg4: String, next_id: i32){
+fn add_event(events: &mut Vec, arg1: String, arg2: String, arg3: String, arg4: String, next_id: i32){
//if any arguments are empty, throw error
if arg1 == "" || arg2 == "" || arg3 == "" {
println!("invalid usage of eadd. use --help to see usage");
@@ -822,7 +571,7 @@ fn add_event(events: &mut Vec, arg1: String, arg2: String, arg3: String,
repeat = Local::now().format("%Y-%m-%d").to_string();
}
//if all criteria are met, add the event to the event list
- let event = Event {
+ let event = Event1 {
description: event_desc,
start: start_time,
end: end_time,
@@ -833,7 +582,7 @@ fn add_event(events: &mut Vec, arg1: String, arg2: String, arg3: String,
println!("event added with id {}", next_id);
}
-fn daily_agenda(events: &mut Vec) {
+fn daily_agenda(events: &mut Vec) {
//get the current date
let now = Local::now();
let today_date = now.format("%Y-%m-%d").to_string();
@@ -842,11 +591,11 @@ fn daily_agenda(events: &mut Vec) {
let today_day = "wednesday";
//lowercase the day of the week
let today_day = today_day.to_lowercase();
- let mut todays_events : Vec = Vec::new();
+ let mut todays_events : Vec = Vec::new();
//get all events that repeat on today's date or today's day of the week
for event in events {
if event.repeat == today_date || event.repeat.contains(&today_day) {
- let eventc = Event {
+ let eventc = Event1 {
description: event.description.clone(),
start: event.start.clone(),
end: event.end.clone(),
@@ -929,14 +678,14 @@ fn daily_agenda(events: &mut Vec) {
}
-fn list_event_ids(events: &mut Vec) {
+fn list_event_ids(events: &mut Vec) {
for event in events {
println!("{} - {}", event.description, event.id);
}
}
-fn remove_event(events: &mut Vec, arg1: String) {
+fn remove_event(events: &mut Vec, arg1: String) {
//parse the event id from the arg1 string
let event_id = arg1.parse::().unwrap();
//find the event with the given id and remove it from the event list
@@ -952,14 +701,14 @@ fn remove_event(events: &mut Vec, arg1: String) {
println!("event with id {} not found", event_id);
}
-fn vayu_ui(tasks: &mut Vec, events: &mut Vec) -> io::Result<()> {
+fn vayu_ui(tasks: &mut Vec, events: &mut Vec) -> io::Result<()> {
//ratatui ui with task list, calendar, and quote of the day
//layout
// *vayu*
// quote of the day
// task list weekly calendar
let task_clone : &mut Vec = tasks;
- let event_clone : &mut Vec = events;
+ let event_clone : &mut Vec = events;
enable_raw_mode()?;
stdout().execute(EnterAlternateScreen)?;
let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
@@ -982,7 +731,7 @@ fn vayu_ui(tasks: &mut Vec, events: &mut Vec) -> io::Result<()> {
Ok(())
}
-fn ui(frame: &mut Frame, tasks: &mut Vec, events: &mut Vec) {
+fn ui(frame: &mut Frame, tasks: &mut Vec, events: &mut Vec) {
//main window
let main_layout = Layout::new(
Direction::Vertical,
@@ -1025,10 +774,10 @@ fn ui(frame: &mut Frame, tasks: &mut Vec, events: &mut Vec) {
day_str.push_str(&cat_day);
let day_box = Block::default().title(day_str.clone());
//rendering the calendar
- let mut todays_events : Vec = Vec::new();
+ let mut todays_events : Vec = Vec::new();
for event in &mut *events {
if event.repeat == day_date || event.repeat.contains(&day_day) {
- let eventc = Event {
+ let eventc = Event1 {
description: event.description.clone(),
start: event.start.clone(),
end: event.end.clone(),
@@ -1156,7 +905,7 @@ fn ui(frame: &mut Frame, tasks: &mut Vec, events: &mut Vec) {
]));
let widths = [Constraint::Length(4), Constraint::Length(10), Constraint::Length(10), Constraint::Length(20), Constraint::Length(20)];
let table = Table::new(rows, widths)
- .block(Block::default().title("Event List"))
+ .block(Block::default().title("Event1 List"))
.header(Row::new(vec![" ", " ", " ", " "," "]).bottom_margin(1).style(Style::default().fg(Color::Yellow).add_modifier(Modifier::BOLD)))
.style(Style::default().fg(Color::White).bg(Color::Black))
.highlight_style(Style::default().add_modifier(Modifier::BOLD))