Skip to content

Repository files navigation

Logo

Gog CLI

Gog CLI is a powerful, interactive command-line interface for managing your Gmail, built with Laravel Zero. It allows you to check your emails directly from your terminal with a beautiful, modern UI.

PHPLaravel Zero

✨ Features

  • 📨 Interactive Email List: View your recent emails in a beautifully formatted table.
  • 🔍 Advanced Search: Search emails using Gmail search operators (from:, subject:, is:unread, etc.).
  • ⚡ Quick Filters: Instant access to unread, starred, attachments, today's, and this week's emails.
  • 👀 Quick Preview: Select an email to instantly view its details and snippet.
  • 🔐 Secure Authentication: OAuth2 integration with Google for secure login.
  • ⚡ Fast: Built for speed and efficiency in the terminal.

🚀 Installation

  1. Clone the repository

    git clone https://github.com/devMuhammad05/gog-cli.git
    cd gog-cli
  2. Install dependencies

    composer install
  3. Setup Credentials

    • Place your Google OAuth credentials.json file in the project's storage path (or configured path).
    • Ensure the google.php config points to the correct credentials location.

🎮 Usage

Authentication

First, you need to authenticate with your Google account. Run:

php gog-cli auth:login

Follow the interactive prompts to authorize the application in your browser.

List Emails

To view your emails, run:

php gog-cli gmail:list

This will:

  1. Fetch your latest emails (with a cool spinner!).
  2. Display them in a table (#, From, Subject, Date).
  3. Prompt you to enter the # of the email you want to read.

List Options

You can specify the number of emails to retrieve:

php gog-cli gmail:list --limit=20

Search Emails

Search your Gmail messages using standard Gmail search operators:

php gog-cli gmail:search "from:boss"
php gog-cli gmail:search "is:unread"
php gog-cli gmail:search "subject:meeting"
php gog-cli gmail:search "has:attachment after:2024/01/01"

This will:

  1. Search your emails using the provided query.
  2. Display matching results in a table.
  3. Allow you to select an email to view its details.

Common search operators:

  • from:sender@example.com - Emails from a specific sender
  • to:recipient@example.com - Emails to a specific recipient
  • subject:keyword - Emails with keyword in subject
  • is:unread - Unread emails
  • is:starred - Starred emails
  • has:attachment - Emails with attachments
  • after:YYYY/MM/DD - Emails after a specific date
  • before:YYYY/MM/DD - Emails before a specific date

Quick Filter Commands

For common searches, use these convenient shortcuts:

# View unread emails
php gog-cli gmail:unread
# View starred emails
php gog-cli gmail:starred
# View emails with attachments
php gog-cli gmail:attachments
# View today's emails
php gog-cli gmail:today
# View this week's emails
php gog-cli gmail:week

These commands provide quick access to frequently needed email filters without having to remember search operators.

🛠 Tech Stack

📄 License

Gog CLI is open-sourced software licensed under the MIT license.

About

GOG CLI — A command-line tool to interact with Gmail and Google services, written in PHP 🐘

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages