gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

calendars with spaces in them cause an error

Open sweth opened this issue 3 years ago • 1 comments

The CLI arg to specify a calendar appears to be misparsed and treated as a start time if the calendar name contains a space. I've tried every variation I can think of to escape the space (after the necessary quoting for the shell) but nothing seems to work.

$ (gcalcli --config-folder ~/etc/gcalcli list | grep gcal ; for CAL in gcalcli-test "gcalcli test" ; do echo "$CAL"
; gcalcli --config-folder ~/etc/gcalcli agenda --calendar="$CAL" ; done)
  owner  gcalcli test
  owner  gcalcli-test
gcalcli-test

No Events Found...
gcalcli test
usage: gcalcli agenda [-h]
                      [--details {calendar,location,length,reminders,description,url,attendees,email,attachments,end,all}]
                      [--color-owner COLOR_OWNER] [--color-writer COLOR_WRITER] [--color-reader COLOR_READER]
                      [--color-freebusy COLOR_FREEBUSY] [--color-date COLOR_DATE] [--color-now-marker COLOR_NOW_MARKER]
                      [--color-border COLOR_BORDER] [--color-title COLOR_TITLE] [--tsv] [--nostarted] [--nodeclined]
                      [--width CAL_WIDTH] [--military] [--no-military] [--override-color]
                      [start] [end]
gcalcli agenda: error: argument start: invalid get_time_from_str value: '--calendar=gcalcli test'

sweth avatar Sep 03 '22 23:09 sweth

I believe you have the "--calendar" option in the wrong position. You can see this from the error where it says "...invalid get_time_from_str value: '--calendar=gcalcli test'". Notice that the error references the complete string '--calendar=gcalcli test' because you're effectively passing that whole string as the start timestamp. I made this same mistake a couple of times while typing out commands. It should be before the sub-command "agenda" like this "gcalcli --calendar="$CAL" agenda...". So what you should have is:

(gcalcli --config-folder ~/etc/gcalcli list | grep gcal ; for CAL in gcalcli-test "gcalcli test" ; do echo "$CAL" ; gcalcli --config-folder ~/etc/gcalcli --calendar="$CAL" agenda ; done)

Hope this clears things up 👍

conceptrat avatar Feb 05 '23 23:02 conceptrat