ungana

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README

commit 461d76f8082c6555a362d66dfcf3ee7fbaacff5f
parent c7d7d90c0b8ca4c3ec6dffead669f0706854e2fc
Author: Carlosokumu <carlosokumu254@gmail.com>
Date:   Tue,  2 Sep 2025 22:11:18 +0300

disable interactive mode for edit: pick up set flags for an ical file that contains multiple events defined.

Diffstat:
Mungana/cmd/args_parser.py | 23+++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/ungana/cmd/args_parser.py b/ungana/cmd/args_parser.py @@ -249,7 +249,7 @@ class ArgsParser: self.parser.error("corrupted or missing ical file") if args.all: - return self._edit_multiple_events(cal, ical_file_path) + return self._edit_multiple_events(cal, ical_file_path,args) updates, attachments = self._get_user_updates_from_args(args) if any([updates, attachments]): @@ -278,7 +278,7 @@ class ArgsParser: logging.info("No changes made to calendar file") - def _edit_multiple_events(self, cal, ical_file_path): + def _edit_multiple_events(self, cal, ical_file_path,args): """Edit a specific event from multiple events (requires --all).""" events = ICalHelper.get_all_events(cal) if not events: @@ -303,16 +303,15 @@ class ArgsParser: except KeyboardInterrupt: self.parser.error("Operation cancelled by user") return - - event = events[choice - 1] - updates = self._get_user_event_updates(event) - - if updates: - ICalHelper.update_event(cal, updates, None, ical_file_path) - logging.info("Calendar updated successfully") - else: - logging.info("No changes made to calendar file") - + + updates, attachments = self._get_user_updates_from_args(args) + if any([updates, attachments]): + try: + ICalHelper.update_event(cal, updates, attachments, ical_file_path) + logging.info("Calendar updated successfully") + except Exception as e: + self.parser.error(f"Failed to update calendar: {e}") + return def _get_user_event_updates(self, event) -> dict: updates = {}