commit 633928b3dd2526536b1274d763f067c1239b0113
parent 4df5c014dc35d574ba06cd0b3307445bcb0e4c88
Author: Carlosokumu <carlosokumu254@gmail.com>
Date: Fri, 29 Aug 2025 18:02:17 +0300
allow user to specify domain using the --domain flag
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/ungana/cmd/args_parser.py b/ungana/cmd/args_parser.py
@@ -104,9 +104,12 @@ class ArgsParser:
non_interactive.add_argument("--sf", "--summary-file", dest="summary_file", help="File containing event summary")
non_interactive.add_argument("--df", "--description-file", dest="description_file", help="File containing event description")
non_interactive.add_argument("--tzid", help="Time zone ID")
- non_interactive.add_argument("--duration", type=self._validate_duration, help="Event duration")
- non_interactive.add_argument("--end", type=self._validate_datetime, help="Event end time")
parser.add_argument("ics_filename", nargs="?", help="Output .ics filename (default: event_<date>.ics)")
+ parser.add_argument("--domain", help="Domain used to generate event UID (default: ungana.local)",default="ungana.local")
+
+ event_end_time_group = non_interactive.add_mutually_exclusive_group(required=False)
+ event_end_time_group.add_argument("--end", type=self._validate_datetime,help="Event end time (ISO format or DD-MM-YYYY HH:MM). ""Required if no --duration is specified.",)
+ event_end_time_group.add_argument( "--duration",type=self._validate_duration, help="Event duration (e.g shorthand like '1h30m'). Required if no --end is specified.",)
@@ -222,7 +225,7 @@ class ArgsParser:
self.ical_manager.save_ical_file(event, ics_filename)
return
- event_data = self._validate_and_get_event_args(args)
+ event_data = self._validate_and_get_create_event_args(args)
if args.ics_filename:
filename = args.ics_filename
@@ -406,7 +409,7 @@ class ArgsParser:
return raw_contact.strip(), {}
- def _validate_and_get_event_args(self, args):
+ def _validate_and_get_create_event_args(self, args):
if args.summary_file:
args.summary = self._read_file_or_exit(args.summary_file)
if args.description_file:
@@ -447,6 +450,10 @@ class ArgsParser:
tzinfo = tz.UTC
args.tzid = "UTC"
+ domain = "ungana.local"
+ if args.domain:
+ domain = args.domain
+
event_data = {
'summary': args.summary,
'description': args.description,
@@ -455,6 +462,7 @@ class ArgsParser:
'start': args.start_dt,
'duration': args.duration,
'tzid': args.tzid,
+ 'domain': domain
}
return event_data