Skip to content

yoshinari-nomura/glima

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glima – Gmail CLI client.

Installation

Glima requires Ruby 2.3 or newer.

Install using gem

$ gem install glima

Install in sandbox

It uses safe navigation operator (&.) introduced in Ruby 2.3.

$ gem install bundler
$ mkdir /path/to/install/glima
$ cd /path/to/install/glima
$ bundle init
$ echo 'gem "glima"' >> Gemfile
$ bundle install --path=vendor/bundle --binstubs=exe
$ export PATH=/path/to/install/glima/exe:$PATH

Install from Docker image

$ docker pull nom4476/glima
$ curl https://raw.githubusercontent.com/yoshinari-nomura/glima/master/exe/glima-docker.sh > glima
$ chmod +x glima
$ mkdir -p ~/.config/glima ~/.cache/glima
$ ./glima help

Setup

  1. Get OAuth CLIENT_ID/CLIENT_SECRET

    Visit https://console.developers.google.com and follow the instruction. Googling ‘Creating a Google API Console project and client ID’ would help.

  2. Create app config file interactively
    $ glima init
    
    Creating ~/.config/glima/config.yml ...
    Get your CLIENT_ID/CLIENT_SECRET at https://console.developers.google.com
    Googling 'Creating a Google API Console project and client ID' would help.
    CLIENT_ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
    CLIENT_SECRET: xxxxxxxxxxxxxxxxxxxxxxxx
    Gmail address: xxxxxxxxxxxxxxx@gmail.com
    
    Making config directory ~/.config/glima ...
          create  /Users/nom/.config/glima
    Making cache directory ~/.cache/glima ...
           exist  Ignore /Users/nom/.cache/glima
    Copying file(s) into ~/.config/glima/config.yml ...
           exist  Ignore ~/.config/glima
              ok  copy /Users/nom/.config/glima/config.yml
    done.
        
  3. Grant OAuth access to Gmail server (browser will be invoked)
    $ glima auth
    
    Authenticating xxxxxxxxxxxxxxx@gmail.com...
    Enter the resulting code: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        

    If you want to add another account, try glima auth --user=another_account.

  4. Check your inbox
    $ glima scan +inbox
    
    1 09/27 14:22 15ec1c9bd2c7f18d Hello....
    2 09/27 14:00 15ec1b716bbb6bdc Yeah...
    :
        

Usage

GLIMA commands:
  glima auth                          # Authenticate interactively
  glima dezip MSGID DIRECTORY         # Decrypt zip found in MSGID to DIRECTORY
  glima events SINCE                  # List operation history SINCE.
  glima guess MSGID                   # Guess labels to add to MSGID
  glima help [COMMAND]                # Describe available commands or one specific command
  glima init                          # Create new config file
  glima label MSGID                   # Add/Remove labels to/from MSGID
  glima labels                        # List labels
  glima open MSGID                    # Open article in browser by MSGID
  glima profile                       # Show user's profile.
  glima push EMAIL_FILE               # Push EMAIL_FILE to INBOX
  glima relabel SOURCE TARGET         # Rename label SOURCE to TARGET.
  glima scan +LABEL [QUERY]           # Scan LABEL with QUERY.
  glima show MSGID                    # Show article.
  glima trash MSGID ...               # Move messages to trash
  glima version                       # Show version
  glima watch QUEUE_LABEL MARK_LABEL  # Watch gmail server and xzip.
  glima xzip TARGET                   # Transform zip-attachments in TARGET and push back to Gmail.

Options:
  [--profile], [--no-profile]  # Set profiler flag
  [--user=USER]                # Set Gmail/IMAP account

Invoke decrypter from emacs mailer (Mew)

Minimum setup: add belows in your .emacs:

(setq load-path
      (cons "~/path/to/this/file load-path"))
(autoload 'axman-mew-decrypt-current-message-gmail "axman")
(autoload 'axman-mew-decrypt-current-message-local "axman")

How to use:

  1. In mew-summary buffer (ie. %inbox), point at an email with encrypted-ZIP attachment.
  2. M-x axman-mew-decrypt-current-message-local
  3. It will find the password from the current folder (%inbox) inspecting in passwordish-emails.

axman-mew-decrypt-current-message-gmail is another version that works with Gmail server. It would be useful if your email server is Gmail with IMAP enabled.

Japanese blog entry about glima xzip.