cmd

package
v0.0.0-...-a92c5f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAliasRecursion int = 10
)

Variables

View Source
var AssumeYes = false
View Source
var BatchMode = false
View Source
var ClearCache = false
View Source
var CriteriaAttrs []string

Initialized in init()

View Source
var DryRun = false
View Source
var EmailToAssert string
View Source
var Quiet = false
View Source
var RootCmd = &cobra.Command{
	Use:   cmdName(),
	Short: "Cli tools for Gmail",
	Long: `A cli tool which can be used to perform more advanced operations on
a gmail account, via the provided Google APIs.`,
}

RootCmd represents the base command when called without any subcommands

View Source
var UseCacheFile = false
View Source
var Verbose = false

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func GetFieldAttr

func GetFieldAttr(x interface{}, attrName string) interface{}

func GetFieldAttrString

func GetFieldAttrString(x interface{}, attrName string) string

func MaybeConfirmFromInput

func MaybeConfirmFromInput(msg string, defaultVal bool) bool

func MaybeConfirmFromInputLong

func MaybeConfirmFromInputLong(msg string) bool

func SetFieldAttr

func SetFieldAttr(x interface{}, attrName string, val interface{})

func SetFieldAttrFromString

func SetFieldAttrFromString(x interface{}, attrName string, valStr string) error

Types

type GmailHelper

type GmailHelper struct {
	User    string
	Account *api.AccountHelper
	Msgs    *api.MsgHelper
	// contains filtered or unexported fields
}

func NewGmailHelper

func NewGmailHelper(srv *gm.Service, user string, conf *config.Config) *GmailHelper

func (*GmailHelper) CreateFilter

func (h *GmailHelper) CreateFilter(filter *gm.Filter) (*gm.Filter, error)

func (*GmailHelper) DeleteFilter

func (h *GmailHelper) DeleteFilter(id string) error

func (*GmailHelper) FilterMessages

func (h *GmailHelper) FilterMessages(
	msgs []*gm.Message, categorizeThreads bool,
	detail api.MessageDetailLevel,
	filter func(*gm.Message, *GmailHelper) bool,
) ([]*gm.Message, error)

func (*GmailHelper) FilterMessagesByInterest

func (h *GmailHelper) FilterMessagesByInterest(
	interest InterestCategory, msgs []*gm.Message) ([]*gm.Message, error)

func (*GmailHelper) FilterMessagesByLabelRegexps

func (h *GmailHelper) FilterMessagesByLabelRegexps(
	labelRegexps []*regexp.Regexp, msgs []*gm.Message) ([]*gm.Message, error)

func (*GmailHelper) FindOutdatedMessages

func (h *GmailHelper) FindOutdatedMessages(baseQuery string, maxMsgs int64) []*gm.Message

maxMsgs should be -1 for unlimited

func (*GmailHelper) GetFilters

func (h *GmailHelper) GetFilters() ([]*gm.Filter, error)

func (*GmailHelper) GetMessageJson

func (h *GmailHelper) GetMessageJson(m *gm.Message) *MessageJson

func (*GmailHelper) GetPlugins

func (h *GmailHelper) GetPlugins() []*plugin.Plugin

func (*GmailHelper) GetTouchLabel

func (h *GmailHelper) GetTouchLabel() api.Label

func (*GmailHelper) MatchesFilter

func (h *GmailHelper) MatchesFilter(regex *regexp.Regexp, filter *gm.Filter) bool

func (*GmailHelper) MessageMatchesLabelRegexps

func (h *GmailHelper) MessageMatchesLabelRegexps(
	msg *gm.Message, labelRegexps []*regexp.Regexp) bool

func (*GmailHelper) MsgInterest

func (h *GmailHelper) MsgInterest(m *gm.Message) InterestCategory

func (*GmailHelper) MsgPlugInterest

func (h *GmailHelper) MsgPlugInterest(m *gm.Message) plugin.InterestLevel

func (*GmailHelper) MustCompileLabelRegexps

func (h *GmailHelper) MustCompileLabelRegexps(labelRegexps []string) []*regexp.Regexp

func (*GmailHelper) PrintFilter

func (h *GmailHelper) PrintFilter(filter *gm.Filter)

func (*GmailHelper) PrintFilterDiff

func (h *GmailHelper) PrintFilterDiff(oldFilter, newFilter *gm.Filter)

func (*GmailHelper) PrintMessage

func (h *GmailHelper) PrintMessage(m *gm.Message, indent int)

func (*GmailHelper) PrintMessagesByCategory

func (h *GmailHelper) PrintMessagesByCategory(msgs []*gm.Message)

func (*GmailHelper) PrintMessagesJson

func (h *GmailHelper) PrintMessagesJson(msgs []*gm.Message)

func (*GmailHelper) RequiredDetailForPluginInterest

func (h *GmailHelper) RequiredDetailForPluginInterest() api.MessageDetailLevel

type InterestCategory

type InterestCategory int
const (
	Uninteresting InterestCategory = iota
	MaybeInteresting
	Interesting
)

type MessageJson

type MessageJson struct {
	MessageId string   `json:"messageId"`
	ThreadId  string   `json:"threadId"`
	Timestamp int64    `json:"timestamp"`
	Subject   string   `json:"subject"`
	From      string   `json:"from"`
	Labels    []string `json:"labels"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL