gcal-cli Google Calendar command line tool for Nod开源项目

我要开发同款
匿名用户2021年11月17日
60阅读

技术信息

开源地址
https://github.com/didi/MeetDot
授权协议
Readme

作品详情

gcal

GoogleCaledarcommadlietoolforNode.js

Programmaticevetlistig,isertorbulkisertmadeeasy:

$gcalisert'Partytomorrowfrom3pmto5pm'Party:2017-09-08T15:00:00+09:00~2017-09-08T17:00:00+09:00https://www.google.com/caledar/evet?eid=amNpMWE5cjg2bG802s0Nmg1ZWlqcW01OXMgdG9rYWdlcm9oQG0$echo\'[{"caledarId":"primary","resource":{"summary":"Party","start":{"dateTime":"2017-09-08T20:00"},"ed":{"dateTime":"2017-09-08T22:00"}}},{"caledarId":"primary","resource":{"summary":"Partyagai","start":{"dateTime":"2017-09-08T22:00"},"ed":{"dateTime":"2017-09-08T23:30"}}}]'\>evets.jso$gcalbulk-eevets.jsoEvetisertedid:gif4hl86kgt7bmgq2ojvteqe2osummary:PartyhtmlLik:https://www.google.com/caledar/evet?eid=Z2lmNGhsODZrZ3Q3Ym1cTJvaZ0ZXFlMm8gdG9rYWdlcm9oQG0Evetisertedid:blrrb8kbrih3pq9m10slii8acsummary:PartyagaihtmlLik:https://www.google.com/caledar/evet?eid=YmxycmI4a2JyaWgzcHE5bW4xMHNsaWk4YWMgdG9rYWdlcm9oQG0$gcallistUpcomigevets(2017-09-07T00:00:00+09:00~2017-09-07T23:59:59+09:00)2017-09-0720:00-MyfavoriteTVshow2017-09-0722:30-Preparetomorrow'smeetigstuffIstallatio

Istallitasaglobalmodule:

pmistall-ggcalAutheticatio

AuthorizatioadautheticatioisdoewithOAuth2.0.

Ok,thiswilltakeoly2miutes:

1)Getyourprojectcredetials

Youwilleedafilewithyourcredetials:clietID,clietsecretadredirectURI.ThiscabeobtaieditheDeveloperCosole:

GotoyourprojectClickiCredetialsClickCreatecredetials→OAuthclietID(ApplicatiotypemustbeOther)DowloadtheJSONfile2)GeeratecosetpageURL

OcewegotthecredetialswemustgeerateacosetpageURL.

$gcalgeerateUrl

(Bydefaultthecredetialswillbesearchediyourhomedirectoryudertheamecliet_secret.jso).

Thepagewillpromptyoutoauthorizeaccess,followtheistructios.

3)Getthetoke!

Withthecodewegotthroughtheauthorizatiopage,wecaobtaiatokeadstoreitiourmachie.

$gcalstoreToke<code>

(Bydefaultthetokeisstorediyourhomefolderudertheamecaledar_api_toke.jso).

NOTE:Thetokewillexpiryafteroehour,butarefresh_tokeisicludedaswell,allowigtheapptorefreshautomaticallythetokeeachtimeit'sused.

Withthiswearegoodtogo.Thestoredtokeadcredetialsfileswillberequiredfromowotousethistool.

UsageList

Listtodayevets:

$gcallist

Listevetsusigaturallaguage(poweredbySherlock):

$gcallisttomorrow$gcallist'from03/23/2017to03/27/2017'$gcallist'fromMarch23thto27th'

OrwithspecificISOdates:

$gcallist-f2017-03-23-t2017-03-27Isert

Isertevetsusigaturallaguage:

$gcalisert'Partytomorrowfrom3pmto5pm'

Isertevetsspecifyigtheparameters:

$gcalisert-s'Party'-d2017-03-23-t15:00-D2hBulkIsert

Bulkisertpassiga.jsor.jsofile:

evets.jso

[{"caledarId":"primary","resource":{"summary":"HavigcoffeewithOkuyasu","locatio":"MorioCity","descriptio":"I'motveryimagiativeowsosomedescriptiogoeshere","start":{"dateTime":"2017-09-08T09:00:00"},"ed":{"dateTime":"2017-09-08T10:00:00"}}},{"caledarId":"primary","resource":{"summary":"DefeatDio","locatio":"179OroubaSt,Cairo","descriptio":"DioisabadboysoIeedtokickhisassasap","start":{"date":"1987-06-01"},"ed":{"date":"1987-06-12"}}}]$gcalbulk-e./evets.jso

Usiga.jsfilecabeusefulforrelativedatesadmore:

evets.js

costtoday=ewDate();today.setHours('17','00','00');costtomorrow=ewDate(today.getTime()+1000*60*60*24);module.exports=[{"caledarId":"primary","resource":{"summary":`Release`,"start":{"dateTime":today.toISOStrig()},"ed":{"dateTime":today.toISOStrig()}}},{"caledarId":"primary","resource":{"summary":"Release","start":{"dateTime":tomorrow.toISOStrig()},"ed":{"dateTime":tomorrow.toISOStrig()}}}];$gcalbulk-e./evets.js

Theavailablepropertiesarelistedhere.

Overwritigdefaultcofig

Usigtheoptio-C<file>thedefaultcofigcabeoverwritte.Thisfilemustbe.jsor.jso.Cofigurableoptiosarelocatedi./cof.js.

Example:

/somepath/cofig.jso

{"CRED_PATH":"/my/secret/path/credetials.jso","TOKEN_PATH":"/my/secret/path/toke.jso"}$gcal-C/somepath/cofig.jsogeerateUrl

Doigthisyoucastoreyourcredetialfileswhereveryouwat.

API

Usethehelpcommad.Moredetailswillbeaddedsoo.

$gcalhelp

Usage:gcal[-C<file>][cmd][--debug]OPTIONS-C,--cofig<file>--debugCommads:list[<term>|[-f<date|datetime>][-t<date|datetime>]][-i]Listevets.Bydefaultitshowstodayevets(executedwithoutargumets).OPTIONS-f,--from<date|datetime>-t,--to<date|datetime>-i,--show-idisert<term>|-s<summary>-d<date>[-t<time>][-D<duratio>]Isertevets.<term>isspecifiediaturallaguage,icaseit'sotspecified,-sad-daremadatory.OPTIONS-s,--summary<summary>-d,--date<date>-t,--time<time>-D,--duratio<duratio>bulk-e<file>Bulkisertofevets.Filecabe.jsoor.js.OPTIONS-e,--evets<file>geerateUrlGeeratecosetpageURL.Iordertoworkcliet_secret.jsmustbeiyourhomefolder.storeToke<code>StoreTokeiyourhomefolder.helpShowthishelppage.Aboutversio0.3.0

Versio0.3.0usedaimmersive-cliisteadofshellcommads.Ifyouwattouseit,gotothebrach0.3.0.

Licese

MIT©AtoioV

功能介绍

gcal Google Calendar command line tool for Node.js Programmatic event listing, insert or bulk ins...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论