To make this easier to configure, I added parsing of the TSV to the template. With this, the user function looks like:
/usr/local/bin/gcalcli --calendar "$calendar" agenda --details all --tsv --nodeclined "$from" "$to"
and the template:
<%*
let agenda = await tp.user.agenda({from: tp.file.title + " 00:00",
to: tp.file.title + " 23:59", prefix: "",
calendar: "<calendar>"})
let rawEvents = agenda.split("\n")
let agendaEntries = rawEvents.map(event => {
let props = event.split("\t")
return ({startDate: props[0],
startTime: props[1],
endDate: props[2],
endTime: props[3],
calendarUrl: props[4],
notSure5: props[5],
conferenceType: props[6],
conferenceUrl: props[7],
title: props[8],
location: props[9],
description: props[10],
meetingUrlOrLocation: props[6] == "video" ? props[7] : props[9],
raw: event,
})
})
tR += agendaEntries.map(e => { return `\t- [ ] ${e.startTime} ${e.title} ${e.meetingUrlOrLocation}`}).join('\n')
%>