insanum / gcalcli

Google Calendar Command Line Interface
MIT License
3.31k stars 311 forks source link

Remind minutes not working #295

Open arsheesh opened 7 years ago

arsheesh commented 7 years ago

First, I'd like to say that this tool is great! It work wonders and I really want to use the remind function to run some script whenever an event occur with Raspbian Jessie. So I test it with

gcalcli remind 5 'echo Hello World'

but the Hello World text appear immediately after I enter the command. Did I missed a command or something? Please let me know as I'm quite a beginner :)

FloGa commented 7 years ago

Hi there!

The remind command will execute the given command immediately when there is an event in your calendar that starts within the given number of minutes.

So in your example, you obviously had some event in your calendar within the next 5 minutes, that's why the command echo Hello World was correctly executed.

If you wanted the command to be executed after 5 minutes, then maybe you want to try something like sleep 5m && echo Hello World?

tdeck commented 7 years ago

I'm having possibly the same problem. Steps to reproduce:

  1. Create an event on my calendar that starts in 10 minutes.
  2. Wait one minute just to ensure there's not a clock skew issue making it hard to repro
  3. Call gcalcli remind 5.

Expected result: No notification Actual result: Notification

FloGa commented 7 years ago

By any chance, do you have the --use_reminders flag activated?

--[no]use_reminders: Honour the remind time when running remind command

Update: Oh, nevermind, I can reproduce the issue, with and without reminders set for the event.

FloGa commented 7 years ago

According to this codeline, the remind command shows all events that will happen between now and minutes + 5. So if you say gcalcli remind 5, you actually get all events from now to 10 minutes in the future. If your event is 11 minutes or more in the future, the command works as expected.

https://github.com/insanum/gcalcli/blob/master/gcalcli#L1897