This application is a CLI that was written in Golang using Cobra, it communicates with your Google calendar, allowing you to create, display and delete events via the command line.
GCP Setup
Follow the steps below to configure your application on GCP, as we need to create a project in it and activate the Calendar API.
Go to Google Cloud Platform here: link
Create a new project
Define project name
Access Google Calendar API page
Enable Google Calendar API
Access credentials page
Access service account option
Service account details
Grant this service account access to project
Click on your created service account
Create new key
Download the JSON file
Save it in the project root with the name
credentials.json
Google Calendar Setup
Follow the steps below to configure your application on Google Calendar.
Go to Google Calendar here: link
Access settings page
Create a new calendar
Share with specific people or groups
Copy the
client_email
from the credentials file previously downloaded from GCP and add this email in this step.
Copy calendar ID
You need to copy the calendar id, as it will be used in the application execution step below.
Execute application
Make sure the credentials.json
file is in the root of the project, as instructed in the GCP setup step.
Change the calendar name in internal/calendar/calendar.go line 17:
const AGENDA = "YOUR CALENDAR NAME"
Install dependencies:
$ go mod download
Build application:
$ go build
Create integration:
$ ./golang-calendar-cli agenda ID
Is the ID copied in the Google Calendar Setup step.
This action is only necessary once.
Create a new event
$ ./golang-calendar-cli events insert --title "New Event" --description "New Event Description" --location "My home" --dateTimeStart "2024-03-29T09:00:00-03:00" --dateTimeEnd "2024-03-29T17:00:00-03:00"
For more details run:
./golang-calendar-cli events insert -h
Show events by day
$ ./golang-calendar-cli events day
Show events by week
$ ./golang-calendar-cli events week
Delete event by ID
$ ./golang-calendar-cli events delete ID
You can get the event ID by viewing events by day or week