Sup3r-Us3r / golang-calendar-cli

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang Calendar CLI

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.

Technologies

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

Step 1

Create a new project

gcp-step-1

Step 2

Define project name

gcp-step-2

Step 3

Access Google Calendar API page

gcp-step-3

Step 4

Enable Google Calendar API

gcp-step-4

Step 5

Access credentials page

gcp-step-5

Step 6

Access service account option

gcp-step-6

Step 7

Service account details

gcp-step-7

Step 8

Grant this service account access to project

gcp-step-8

Step 9

Click on your created service account

gcp-step-9

Step 10

Create new key

gcp-step-10

Step 11

Download the JSON file

gcp-step-11

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

Step 1

Access settings page

google-calendar-step-1

Step 2

Create a new calendar

google-calendar-step-2 google-calendar-step-2-1

Step 3

Share with specific people or groups

google-calendar-step-3

Copy the client_email from the credentials file previously downloaded from GCP and add this email in this step.

Step 4

Copy calendar ID

google-calendar-step-4

You need to copy the calendar id, as it will be used in the application execution step below.

Execute application

Setup app

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

Execute app

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.

Commands

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

About

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

License:MIT License


Languages

Language:Go 100.0%