Giter Club home page Giter Club logo

cmdg's Introduction

cmdg - A command line client to GMail

Copyright Thomas Habets [email protected] 2015-2021

https://github.com/ThomasHabets/cmdg

License

This software is dual-licensed GPL and "Thomas is allowed to release a binary version that adds shared API keys and nothing else".

Introduction

cmdg is a commandline client to GMail that provides a UI more similar to Pine/Alpine.

It uses the GMail API to interact with your mailbox. This has several benefits.

Benefits over IMAP

  • No passwords stored on disk. (application-specific passwords are also passwords, and can be used for more than GMail). OAuth2 is used instead, and cmdgs access can be revoked here. cmdg can only access your GMail, and cannot lose your password even if the machine it runs on gets hacked.
  • The "labels" model is native in the cmdg UI, unlike IMAP clients that try to map GMail labels onto IMAP.
  • Contacts are taken from your Google contacts
  • TODO: other benefits, I'm sure.

Benefits over the GMail web UI

  • Emacs-ish keys. If there's a need the key mapping can be made configurable.
  • Uses a real $EDITOR.
  • Really fast. No browser, CSS, or javascript getting in the way.
  • Proper quoting. The GMail web UI encourages top-posting. Ugh.
  • It uses 100% keyboard navigation. GMail web UI has very good keyboard navigation for a web app, but still requires mouse for a few things.
  • cmdg works without a graphic terminal.
  • cmdg uses less bandwidth (citation needed), and much less memory.
  • Local GPG integration. There are currently no good ways to integrate GPG with the GMail web UI.

A security difference

  • GMail web UI uses username and password to log in, which means they can be stolen. You should be using U2F Yubikeys, so that losing the password isn't as big of a deal. The user has to re-type the password every now and then, which is an opportunity for the attacker to steal the password.
  • OAuth token in cmdg.conf can be copied, and the thief would be able to access the users GMail until the key is revoked. The access does not expire on its own.

Installing

Building manually

$ go build ./cmd/cmdg
$ sudo cp cmdg /usr/local/bin

Homebrew (maintained by separate author)

brew tap cutzenfriend/homebrew-cmdg
brew install cmdg

Configuring

You need to configure cmdg in order to provide it with authentication so it can talk to GMail on your behalf. To do this you'll need to generate a ClientID and ClientSecret. You can do this with the following steps:

  1. Go to the Google Developers Console.
  2. Select an existing project or create a new project
  3. Navigate to the "APIs & Services > OAuth consent screen" page.
  4. Fill out the OAuth consent screen.
  5. Make sure to add scopes for the various APIs you'll need
    1. Drive API - .../auth/drive.appdata
    2. Gmail API - ../auth/gmail.modify
    3. People API - .../auth/contacts.readonly
  6. Click the button "Create Credentials" and select "OAuth client ID" from the dropdown.
  7. Set the "Application type" to "Desktop app" and make the name anything you'd like.
  8. This should give you a Client ID and Client Secret you can provide to cmdg.
$ cmdg -configure
[It will ask about ClientID and ClientSecret.
For now you have create one at https://console.developers.google.com]
Cut and paste this URL into your browser:
  https://long-url....
Returned code: <paste code here>
$

This creates ~/.cmdg/cmdg.conf.

Running

$ cmdg

For keyboard shortcuts press '?' or F1 in most screens.

To quit, press 'q'.

cmdg's People

Contributors

thomashabets avatar edwardwang888 avatar joeschr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.