@@ -354,6 +354,30 @@ def get_search_parser():
354354 return search_parser
355355
356356
357+ def get_automation_parser ():
358+ # Flags for skipping confirmation prompts
359+ automation_parser = argparse .ArgumentParser (add_help = False )
360+ automation_parser .add_argument (
361+ '--yes' , '-y' ,
362+ action = 'store_true' ,
363+ dest = 'noconfirm' ,
364+ help = 'Answer "yes" to all prompts (e.g. delete confirmation)'
365+ )
366+ automation_parser .add_argument (
367+ '--force' , '-f' ,
368+ action = 'store_true' ,
369+ dest = 'noconfirm' ,
370+ help = 'Alias for --yes'
371+ )
372+ automation_parser .add_argument (
373+ '--no-prompt' ,
374+ action = 'store_true' ,
375+ dest = 'noconfirm' ,
376+ help = 'Alias for --yes'
377+ )
378+ return automation_parser
379+
380+
357381def handle_unparsed (unparsed , namespace ):
358382 # Attempt a reparse against the program options.
359383 # Provides some robustness for misplaced global options
@@ -450,6 +474,9 @@ def get_argument_parser():
450474
451475 # tacks on search text
452476 search_parser = get_search_parser ()
477+
478+ # automation flags
479+ automation_parser = get_automation_parser ()
453480
454481 sub = parser .add_subparsers (
455482 help = 'Invoking a subcommand with --help prints subcommand usage.' ,
@@ -496,13 +523,13 @@ def get_argument_parser():
496523
497524 delete = sub .add_parser (
498525 'delete' ,
499- parents = [calendars_parser , output_parser , search_parser ],
526+ parents = [calendars_parser , output_parser , search_parser , automation_parser ],
500527 help = 'delete events from the calendar' ,
501528 description = 'Case insensitive search for items to delete '
502529 'interactively.' ,
503530 )
504531 delete .add_argument (
505- '--iamaexpert' , action = 'store_true' , help = 'Probably not '
532+ '--iamaexpert' , action = 'store_true' , help = 'Legacy alias for --yes '
506533 )
507534
508535 sub .add_parser (
@@ -656,7 +683,7 @@ def get_argument_parser():
656683
657684 _import = sub .add_parser (
658685 'import' ,
659- parents = [calendar_parser , remind_parser ],
686+ parents = [calendar_parser , remind_parser , automation_parser ],
660687 help = 'import an ics/vcal file to a calendar' ,
661688 description = 'Import from an ics/vcal file; a single --calendar '
662689 'must be specified. Reads from stdin when no file argument is '
0 commit comments