{"id":15885819,"url":"https://github.com/toniov/gcal-cli","last_synced_at":"2025-04-06T07:09:48.743Z","repository":{"id":3232234,"uuid":"42236186","full_name":"toniov/gcal-cli","owner":"toniov","description":"Google Calendar command line tool for Node.js","archived":false,"fork":false,"pushed_at":"2022-07-07T03:41:25.000Z","size":51,"stargazers_count":275,"open_issues_count":9,"forks_count":31,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T17:06:45.410Z","etag":null,"topics":["cal-api","cli","command-line-interface","command-line-tool","google","google-calendar","googleapis"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toniov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-10T09:47:10.000Z","updated_at":"2025-02-20T17:11:29.000Z","dependencies_parsed_at":"2022-08-06T13:16:29.953Z","dependency_job_id":null,"html_url":"https://github.com/toniov/gcal-cli","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toniov%2Fgcal-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toniov%2Fgcal-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toniov%2Fgcal-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toniov%2Fgcal-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toniov","download_url":"https://codeload.github.com/toniov/gcal-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247445667,"owners_count":20939958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cal-api","cli","command-line-interface","command-line-tool","google","google-calendar","googleapis"],"created_at":"2024-10-06T05:08:00.196Z","updated_at":"2025-04-06T07:09:48.714Z","avatar_url":"https://github.com/toniov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcal\n\n\u003e Google Calendar command line tool for Node.js\n\nProgrammatic event listing, insert or bulk insert made easy:\n\n\u003cpre\u003e\n  \u003cb\u003e$ gcal insert 'Party tomorrow from 3pm to 5pm'\u003c/b\u003e\n\n   Party: 2017-09-08T15:00:00+09:00 ~ 2017-09-08T17:00:00+09:00\n   https://www.google.com/calendar/event?eid=amNpMWE5cjg2bG80n2s0Nmg1ZWlqcW01OXMgdG9rYWdlcm9oQG0\n\u003c/pre\u003e\n\n\u003cpre\u003e\n  $ echo \\\n  '[{\n    \"calendarId\": \"primary\", \"resource\": {\n    \"summary\": \"Party\",\n    \"start\": { \"dateTime\": \"2017-09-08T20:00\" },\n    \"end\": { \"dateTime\": \"2017-09-08T22:00\" }}\n  },{\n    \"calendarId\": \"primary\", \"resource\": {\n    \"summary\": \"Party again\",\n    \"start\": { \"dateTime\": \"2017-09-08T22:00\" },\n    \"end\": { \"dateTime\": \"2017-09-08T23:30\" }}\n  }]' \\\n  \u003e events.json\n\n  \u003cb\u003e$ gcal bulk -e events.json\u003c/b\u003e\n\n   Event inserted\n    id: gif4hl86kgt7bmgq2ojvteqe2o\n    summary: Party\n    htmlLink: https://www.google.com/calendar/event?eid=Z2lmNGhsODZrZ3Q3Ym1ncTJvanZ0ZXFlMm8gdG9rYWdlcm9oQG0\n   Event inserted\n    id: blrrb8kbrih3pq9mn10slii8ac\n    summary: Party again\n    htmlLink: https://www.google.com/calendar/event?eid=YmxycmI4a2JyaWgzcHE5bW4xMHNsaWk4YWMgdG9rYWdlcm9oQG0\n\u003c/pre\u003e\n\n\u003cpre\u003e\n  \u003cb\u003e$ gcal list\u003c/b\u003e\n\n   Upcoming events (2017-09-07T00:00:00+09:00 ~ 2017-09-07T23:59:59+09:00)\n    2017-09-07 20:00 - My favorite TV show\n    2017-09-07 22:30 - Prepare tomorrow's meeting stuff\n\u003c/pre\u003e\n\n## Installation\n\nInstall it as a global module:\n\n```\nnpm install -g gcal\n```\n\n## Authentication\n\nAuthorization and authentication is done with OAuth 2.0. \n\nOk, this will take only 2 minutes:\n\n#### 1) Get your project credentials\n\nYou will need a file with your credentials: `client ID`, `client secret` and `redirect URI`. This can be obtained in the [Developer Console](https://console.developers.google.com):\n\n- Go to your project\n- Click in `Credentials`\n- Click `Create credentials` → `OAuth client ID` ( `Application type` must be `Other` )\n- Download the JSON file\n\n#### 2) Generate consent page URL\n\nOnce we got the credentials we must generate a consent page URL.\n\n```\n$ gcal generateUrl\n```\n\n([By default](#overwriting-default-config) the credentials will be searched in your home directory under the name `client_secret.json`).\n\nThe page will prompt you to authorize access, follow the instructions.\n\n#### 3) Get the token!\n\nWith the code we got through the authorization page, we can obtain a token and store it in our machine.\n\n```\n$ gcal storeToken \u003ccode\u003e\n```\n\n([By default](#overwriting-default-config) the token is stored in your home folder under the name `calendar_api_token.json`). \n\nNOTE: The token will expiry after one hour, but a `refresh_token` is included as well, allowing the app to refresh automatically the token each time it's used.\n\nWith this we are good to go. The stored token and credentials files will be required from now on to use this tool.\n\n## Usage\n\n### List\n\nList today events:\n\n```\n$ gcal list\n```\n\nList events using natural language (powered by [Sherlock](https://github.com/neilgupta/Sherlock)):\n\n```\n$ gcal list tomorrow\n```\n\n```\n$ gcal list 'from 03/23/2017 to 03/27/2017'\n```\n\n```\n$ gcal list 'from March 23th to 27th'\n```\n\nOr with specific ISO dates:\n\n```\n$ gcal list -f 2017-03-23 -t 2017-03-27\n```\n\n### Insert\n\nInsert events using natural language:\n\n```\n$ gcal insert 'Party tomorrow from 3pm to 5pm'\n```\n\nInsert events specifying the parameters:\n\n```\n$ gcal insert -s 'Party' -d 2017-03-23 -t 15:00 -D 2h\n```\n\n### Bulk Insert\n\nBulk insert passing a `.js` or `.json` file:\n\n`events.json`\n```json\n[{\n  \"calendarId\": \"primary\",\n  \"resource\": {\n    \"summary\": \"Having coffee with Okuyasu\",\n    \"location\": \"Morio City\",\n    \"description\": \"I'm not very imaginative now so some description goes here\",\n    \"start\": {\n      \"dateTime\": \"2017-09-08T09:00:00\"\n    },\n    \"end\": {\n      \"dateTime\": \"2017-09-08T10:00:00\"\n    }\n  }\n}, {\n  \"calendarId\": \"primary\",\n  \"resource\": {\n    \"summary\": \"Defeat Dio\",\n    \"location\": \"179 Orouba St, Cairo\",\n    \"description\": \"Dio is a bad boy so I need to kick his ass asap\",\n    \"start\": {\n      \"date\": \"1987-06-01\"\n    },\n    \"end\": {\n      \"date\": \"1987-06-12\"\n    }\n  }\n}]\n```\n```\n$ gcal bulk -e ./events.json\n```\n\nUsing a `.js` file can be useful for relative dates and more:\n\n`events.js`\n```js\nconst today = new Date();\ntoday.setHours('17', '00', '00');\nconst tomorrow = new Date(today.getTime()+1000*60*60*24);\nmodule.exports = [{\n  \"calendarId\": \"primary\",\n  \"resource\": {\n    \"summary\": `Release`,\n    \"start\": {\n      \"dateTime\": today.toISOString()\n    },\n    \"end\": {\n      \"dateTime\": today.toISOString()\n    }\n  }\n}, {\n  \"calendarId\": \"primary\",\n  \"resource\": {\n    \"summary\": \"Release\",\n    \"start\": {\n      \"dateTime\": tomorrow.toISOString()\n    },\n    \"end\": {\n      \"dateTime\": tomorrow.toISOString()\n    }\n  }\n}];\n```\n```\n$ gcal bulk -e ./events.js\n```\n\nThe available properties are listed [here](https://developers.google.com/google-apps/calendar/v3/reference/events/insert).\n\n### Overwriting default config\n\nUsing the option `-C \u003cfile\u003e` the default config can be overwritten. This file must be `.js` or `.json`. Configurable options are located in [./conf.js](./conf.js).\n\nExample:\n\n`/somepath/config.json`\n```json\n{\n  \"CRED_PATH\": \"/my/secret/path/credentials.json\",\n  \"TOKEN_PATH\": \"/my/secret/path/token.json\"\n}\n```\n\n```\n$ gcal -C /somepath/config.json generateUrl\n```\n\nDoing this you can store your credential files wherever you want.\n\n## API\n\nUse the `help` command. More details will be added soon.\n\n**`$ gcal help`**\n```\nUsage:\n  gcal [-C \u003cfile\u003e] [cmd] [--debug]\n\n      OPTIONS\n          -C, --config \u003cfile\u003e\n          --debug\n\nCommands:\n\n  list [\u003cterm\u003e | [-f \u003cdate | datetime\u003e] [-t \u003cdate | datetime\u003e]] [-i]\n      List events. By default it shows today events (executed without arguments).\n\n      OPTIONS\n          -f, --from \u003cdate | datetime\u003e\n\n          -t, --to \u003cdate | datetime\u003e\n\n          -i, --show-id\n\n\n  insert \u003cterm\u003e | -s \u003csummary\u003e -d \u003cdate\u003e [-t \u003ctime\u003e] [-D \u003cduration\u003e]\n      Insert events. \u003cterm\u003e is specified in natural language, in case it's not specified,\n      -s and -d are mandatory.\n\n      OPTIONS\n          -s, --summary \u003csummary\u003e\n\n          -d, --date \u003cdate\u003e\n\n          -t, --time \u003ctime\u003e\n\n          -D, --duration \u003cduration\u003e\n\n\n  bulk -e \u003cfile\u003e\n      Bulk insert of events. File can be .json or .js.\n\n      OPTIONS\n          -e, --events \u003cfile\u003e\n\n\n  generateUrl\n      Generate consent page URL. In order to work client_secret.js must be in your\n      home folder.\n\n\n  storeToken \u003ccode\u003e\n      Store Token in your home folder.\n\n\n  help\n      Show this help page.\n```\n\n## About version 0.3.0\n\nVersion 0.3.0 used an immersive-cli instead of shell commands. If you want to use it, go to the branch [0.3.0](https://github.com/toniov/gcal-cli/tree/0.3.0).\n\n## License\n\nMIT © [Antonio V](https://github.com/toniov)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoniov%2Fgcal-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoniov%2Fgcal-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoniov%2Fgcal-cli/lists"}