A golang CLI tool for managing Gmail filters and messages. Builds into the gmailcli
binary.
gmailcli search
provides an array of search tools which are not available through the Gmail interface, including custom "interest" categorization.
Set up a configuration file in ~/.gmailcli/config.yaml, and search for "interesting" and "uninteresting" messages, and apply labels to matching messages. This can enable you to perform more powerful filtering on your inbox. An example exists in config_example.yaml
The tools is enabled with an expanding set of plugin interfaces, which can be used for more complicated categorization, such as building on the "interest" categorization, classifying "out of date" messages, etc.
More to come, for more general purpose plugin interfaces.
Examples, via built-in plugins, are provided in the plugins directory.
Use the filter
subcommand to perform actions on gmail filters.
Create "templates" in your filters, which can be copied from other filters that
define the primary version. Use the filter update
command do do this.
Each template is marked with a meta tag in the following format:
{(M3TA mytemplatename) "match against this stuff"}
Primary templates use M3TAP
instead.
- The
filter replace
command allows you do to do regex replacements on all filters.
As a convenience feature, command aliases can be specified in config.yaml under the Aliases section. Each entry consists of the alias name and a command to run.
Aliases MAY reference each other (though there is a maximum depth enforced)
Positional arguments passed to the alias can be placed in a specific location in the target command by using $n (starting at $1). Note that positional arguments MUST either come before any flags or after the -- marker, since at alias parse time, the semantics of the flags in the target command are not yet known.
The remainder of the arguments (not specified explicitly via $n) can also be placed with $R. This defaults to the end of the command argument list.
make getdeps
make
make test
export PATH=$PATH:$(pwd)/bld
gmailcli ...
This application does not provide a global API key. You will need to create an API project in the Google developer console.
- Go to https://console.developers.google.com
- Create a new project
- Go to the Credential section in the new project
- Click "Create credentials", and select OAuth client ID
- Select type "Other" for the credential
- Click the "Download JSON" button on the new credential.
- Move the downloaded credential file to
~/.gmailcli/client_secret.json
To log into a gmail account, run any gmailcli command which attempts to access the service. Follow the link, and paste the authentication code into the console.
gmailcli authorize
is conveniently provided which does nothing but sign in.