Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gcalcli/argparsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ def get_argument_parser():
'--use_reminders', action=DeprecatedStoreTrue, help=argparse.SUPPRESS
)

remind.add_argument(
'--only-accepted',
action='store_true',
help='Only remind for accepted or tentatively accepted events',
)

config = sub.add_parser(
'config',
help='utility commands to work with configuration',
Expand Down
3 changes: 2 additions & 1 deletion gcalcli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ def main():
elif parsed_args.command == 'remind':
gcal.Remind(
parsed_args.minutes, parsed_args.cmd,
use_reminders=parsed_args.use_reminders
use_reminders=parsed_args.use_reminders,
only_accepted=parsed_args.only_accepted
)

elif parsed_args.command == 'import':
Expand Down
15 changes: 14 additions & 1 deletion gcalcli/gcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,8 @@ def ModifyEvents(self, work, search_text, start=None, end=None,
return self._iterate_events(
self.now, event_list, year_date=True, work=work)

def Remind(self, minutes, command, use_reminders=False):
def Remind(self, minutes, command, use_reminders=False,
only_accepted=False):
"""
Check for events between now and now+minutes.

Expand Down Expand Up @@ -1542,6 +1543,18 @@ def Remind(self, minutes, command, use_reminders=False):
# don't remind if all reminders haven't arrived yet
continue

# if only_accepted, skip if self not accepted or tentative
if only_accepted:
if 'attendees' not in event:
continue
attendee_self = next((a for a in event['attendees'] \
if 'self' in a and a['self']), None)
if not attendee_self \
or 'responseStatus' not in attendee_self \
or attendee_self['responseStatus'] not in \
['accepted', 'tentative']:
continue

if self.options.get('military'):
tmp_time_str = event['s'].strftime('%H:%M')
else:
Expand Down
Loading