레이블이 gws인 게시물을 표시합니다. 모든 게시물 표시
레이블이 gws인 게시물을 표시합니다. 모든 게시물 표시

googleworkspace-cli

gws(https://github.com/googleworkspace/cli) 커맨드로 캘린더 조회
gws 설치
brew install googleworkspace-cli

인증/로그인
1. 구글 콘솔 로그인(예: https://console.cloud.google.com/auth/clients?project=watchdust)
2. 테스트 사용자 섹션 > Add users > ysoftman@gmail.com 추가
https://console.cloud.google.com/auth/audience?project=watchdust
3. 클라이언트 만들기 > 애플리케이션 유형 데스크톱 앱(터미널 커맨드라 앱을 선택해야 한다.) > 이름 gws 생성
4. JSON 다운로드 후 교체
mv ~/Downloads/client_secret_*.json ~/.config/gws/client_secret.json
chmod 600 ~/.config/gws/client_secret.json
5. gws auth login
터미널에 표시되는 url 이 길러 클릭하면 잘릴 수 있어 전체 복사해서 브라우저에서 수동으로 열어야 했다.

테스트 모드에서 발급된 refresh token 은 7일 후 만료돼 다시 로그인이 필요하다.

# gws 사용 예시
# 안 읽은 메일
gws gmail +triage
gws gmail +triage --max 5 --query 'from:noreply@crates.io'
gws gmail +triage --format json | jq -r '.[].subject'

# 읽은 메일까지 보기
gws gmail +triage --query 'in:inbox' --max 10

# 본문 읽기
gws gmail +read --id MESSAGE_ID
gws gmail +read --id MESSAGE_ID --headers

# 메일 보내기
gws gmail +send --to alice@example.com --subject '테스트' --body '내용' --dry-run
gws gmail +send --to alice@example.com --subject '보고서' --body '첨부 확인' -a report.pdf
gws gmail +send --to alice@example.com --subject '초안' --body '나중에' --draft

# 메일 답장
gws gmail +reply --id MESSAGE_ID --body '확인했습니다'

# 메일 전달
gws gmail +forward --id MESSAGE_ID --to bob@example.com

# 앞으로 일정
gws calendar +agenda
gws calendar +agenda --today
gws calendar +agenda --week --format table
gws calendar +agenda --days 3 --calendar 'Work'

# 일정 추가
gws calendar +insert --summary '스탠드업' \
  --start '2026-08-11T09:00:00+09:00' --end '2026-08-11T09:30:00+09:00'
gws calendar +insert --summary '리뷰' \
  --start '2026-08-11T14:00:00+09:00' --end '2026-08-11T15:00:00+09:00' \
  --attendee alice@example.com --meet

# 일정 삭제
gws calendar events delete --params '{"calendarId":"primary","eventId":"EVENT_ID"}'

# 드라이브 파일 조회
gws drive files list --params '{"pageSize":10,"fields":"files(id,name,mimeType,modifiedTime)"}' --format table

# 보고서 단어가 포함된 파일 조회
gws drive files list --params '{"q":"name contains \"보고서\" and trashed=false"}' --format table

# pdf 형식 파일 조회
gws drive files list --params '{"q":"mimeType=\"application/pdf\""}' --format table

# 파일 업로드
gws drive +upload ./report.pdf
gws drive +upload ./data.csv --name '매출.csv' --parent FOLDER_ID

# 파일 다운로드
gws drive files export --params '{"fileId":"DOC_ID","mimeType":"application/pdf"}' -o doc.pdf

Prev