cli

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.2.1"

Functions

func GenerateHelpJSON

func GenerateHelpJSON(cli *CLI) ([]byte, error)

func PrintHelpJSON

func PrintHelpJSON(cli *CLI) error

Types

type ArgSchema

type ArgSchema struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Required    bool   `json:"required"`
	Description string `json:"description"`
}

type CLI

type CLI struct {
	Globals

	Config   ConfigCmd   `cmd:"" help:"Configuration management"`
	Mail     MailCmd     `cmd:"" help:"Email operations"`
	Mailbox  MailboxCmd  `cmd:"" help:"Mailbox management"`
	Contacts ContactsCmd `cmd:"" help:"Address book management"`
	Version  VersionCmd  `cmd:"" help:"Show version information"`
}

type CommandSchema

type CommandSchema struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Flags       []FlagSchema    `json:"flags,omitempty"`
	Args        []ArgSchema     `json:"args,omitempty"`
	Subcommands []CommandSchema `json:"subcommands,omitempty"`
	Examples    []string        `json:"examples,omitempty"`
}

type ConfigCmd

type ConfigCmd struct {
	Init     ConfigInitCmd     `cmd:"" help:"Interactive setup wizard"`
	Show     ConfigShowCmd     `cmd:"" help:"Display current configuration"`
	Set      ConfigSetCmd      `cmd:"" help:"Set a configuration value"`
	Validate ConfigValidateCmd `cmd:"" help:"Test Bridge connection"`
	Doctor   ConfigDoctorCmd   `cmd:"" help:"Diagnose configuration issues"`
}

ConfigCmd handles configuration management

type ConfigDoctorCmd

type ConfigDoctorCmd struct{}

func (*ConfigDoctorCmd) Run

func (c *ConfigDoctorCmd) Run(ctx *Context) error

type ConfigInitCmd

type ConfigInitCmd struct{}

func (*ConfigInitCmd) Run

func (c *ConfigInitCmd) Run(ctx *Context) error

type ConfigSetCmd

type ConfigSetCmd struct {
	Key   string `arg:"" help:"Configuration key (e.g., bridge.email, defaults.limit)"`
	Value string `arg:"" help:"Value to set"`
}

func (*ConfigSetCmd) Run

func (c *ConfigSetCmd) Run(ctx *Context) error

type ConfigShowCmd

type ConfigShowCmd struct{}

func (*ConfigShowCmd) Run

func (c *ConfigShowCmd) Run(ctx *Context) error

type ConfigValidateCmd

type ConfigValidateCmd struct{}

func (*ConfigValidateCmd) Run

func (c *ConfigValidateCmd) Run(ctx *Context) error

type ContactsAddCmd

type ContactsAddCmd struct {
	Email string `arg:"" help:"Contact email address"`
	Name  string `help:"Contact display name" short:"n" name:"name"`
}

func (*ContactsAddCmd) Run

func (c *ContactsAddCmd) Run(ctx *Context) error

type ContactsCmd

type ContactsCmd struct {
	List   ContactsListCmd   `cmd:"" help:"List all contacts"`
	Search ContactsSearchCmd `cmd:"" help:"Search contacts"`
	Add    ContactsAddCmd    `cmd:"" help:"Add a contact"`
	Remove ContactsRemoveCmd `cmd:"" help:"Remove a contact"`
}

ContactsCmd handles address book management

type ContactsListCmd

type ContactsListCmd struct{}

func (*ContactsListCmd) Run

func (c *ContactsListCmd) Run(ctx *Context) error

type ContactsRemoveCmd

type ContactsRemoveCmd struct {
	Email string `arg:"" help:"Contact email address to remove"`
}

func (*ContactsRemoveCmd) Run

func (c *ContactsRemoveCmd) Run(ctx *Context) error

type ContactsSearchCmd

type ContactsSearchCmd struct {
	Query string `arg:"" help:"Search query (matches name or email)"`
}

func (*ContactsSearchCmd) Run

func (c *ContactsSearchCmd) Run(ctx *Context) error

type Context

type Context struct {
	Config    *config.Config
	Formatter *output.Formatter
	Globals   *Globals
}

func NewContext

func NewContext(globals *Globals) (*Context, error)

type DraftCmd

type DraftCmd struct {
	List   DraftListCmd   `cmd:"" help:"List all drafts"`
	Create DraftCreateCmd `cmd:"" help:"Create a new draft"`
	Edit   DraftEditCmd   `cmd:"" help:"Edit an existing draft"`
	Delete DraftDeleteCmd `cmd:"" help:"Delete a draft"`
}

DraftCmd handles draft management

type DraftCreateCmd

type DraftCreateCmd struct {
	To      []string `help:"Recipient(s)" short:"t"`
	CC      []string `help:"CC recipients"`
	Subject string   `help:"Subject line" short:"s"`
	Body    string   `help:"Body text" short:"b"`
	Attach  []string `help:"Attachments" short:"a" type:"existingfile"`
}

func (*DraftCreateCmd) Run

func (c *DraftCreateCmd) Run(ctx *Context) error

type DraftDeleteCmd

type DraftDeleteCmd struct {
	IDs []string `arg:"" help:"Draft ID(s) to delete"`
}

func (*DraftDeleteCmd) Run

func (c *DraftDeleteCmd) Run(ctx *Context) error

type DraftEditCmd

type DraftEditCmd struct {
	ID      string   `arg:"" help:"Draft ID to edit"`
	To      []string `help:"Recipient(s)" short:"t"`
	CC      []string `help:"CC recipients"`
	Subject string   `help:"Subject line" short:"s"`
	Body    string   `help:"Body text" short:"b"`
	Attach  []string `help:"Attachments" short:"a" type:"existingfile"`
}

func (*DraftEditCmd) Run

func (c *DraftEditCmd) Run(ctx *Context) error

type DraftListCmd

type DraftListCmd struct {
	Limit int `help:"Number of drafts" short:"n" default:"20"`
}

func (*DraftListCmd) Run

func (c *DraftListCmd) Run(ctx *Context) error

type FlagSchema

type FlagSchema struct {
	Name        string `json:"name"`
	Short       string `json:"short,omitempty"`
	Type        string `json:"type"`
	Default     string `json:"default,omitempty"`
	Required    bool   `json:"required,omitempty"`
	Description string `json:"description"`
}

type Globals

type Globals struct {
	JSON     bool   `help:"Output as JSON" name:"json"`
	HelpJSON bool   `help:"Output command help as JSON (AI agent mode)" name:"help-json"`
	Config   string `help:"Path to config file" short:"c" type:"path"`
	Verbose  bool   `help:"Verbose output" short:"v"`
	Quiet    bool   `help:"Suppress non-essential output" short:"q"`
	NoColor  bool   `help:"Disable colored output" name:"no-color" env:"NO_COLOR"`
}

type HelpSchema

type HelpSchema struct {
	Name        string          `json:"name"`
	Version     string          `json:"version"`
	Description string          `json:"description"`
	Commands    []CommandSchema `json:"commands"`
	GlobalFlags []FlagSchema    `json:"global_flags"`
}

type LabelAddCmd

type LabelAddCmd struct {
	IDs     []string `arg:"" help:"Message ID(s) to label"`
	Label   string   `help:"Label name to add" short:"l" required:""`
	Mailbox string   `help:"Source mailbox" short:"m" default:"INBOX"`
}

func (*LabelAddCmd) Run

func (c *LabelAddCmd) Run(ctx *Context) error

Run adds a label to message(s) by copying them to the label folder. In Proton Bridge, adding a label is done by copying the message to the corresponding Labels/LabelName folder.

type LabelCmd

type LabelCmd struct {
	List   LabelListCmd   `cmd:"" help:"List available labels"`
	Add    LabelAddCmd    `cmd:"" help:"Add label to message(s)"`
	Remove LabelRemoveCmd `cmd:"" help:"Remove label from message(s)"`
}

LabelCmd handles label management

type LabelInfo

type LabelInfo struct {
	Name     string `json:"name"`
	FullPath string `json:"full_path"`
}

LabelInfo represents a Proton Mail label.

type LabelListCmd

type LabelListCmd struct{}

func (*LabelListCmd) Run

func (c *LabelListCmd) Run(ctx *Context) error

Run lists all available labels. In Proton Bridge, labels are exposed as folders under the "Labels/" parent folder.

type LabelRemoveCmd

type LabelRemoveCmd struct {
	IDs   []string `arg:"" help:"Message ID(s) to unlabel"`
	Label string   `help:"Label name to remove" short:"l" required:""`
}

func (*LabelRemoveCmd) Run

func (c *LabelRemoveCmd) Run(ctx *Context) error

Run removes a label from message(s) by deleting them from the label folder. The message must be accessed from within the label folder to remove it.

type MailCmd

type MailCmd struct {
	List      MailListCmd      `cmd:"" help:"List messages in mailbox"`
	Read      MailReadCmd      `cmd:"" help:"Read a specific message"`
	Send      MailSendCmd      `cmd:"" help:"Compose and send email"`
	Reply     MailReplyCmd     `cmd:"" help:"Reply to a message"`
	Forward   MailForwardCmd   `cmd:"" help:"Forward a message"`
	Delete    MailDeleteCmd    `cmd:"" help:"Delete message(s)"`
	Move      MailMoveCmd      `cmd:"" help:"Move message to mailbox"`
	Flag      MailFlagCmd      `cmd:"" help:"Manage message flags"`
	Search    MailSearchCmd    `cmd:"" help:"Search messages"`
	Download  MailDownloadCmd  `cmd:"" help:"Download attachment"`
	Draft     DraftCmd         `cmd:"" help:"Manage drafts"`
	Thread    MailThreadCmd    `cmd:"" help:"Show conversation thread"`
	Watch     MailWatchCmd     `cmd:"" help:"Watch for new messages"`
	Label     LabelCmd         `cmd:"" help:"Manage message labels"`
	Summarize MailSummarizeCmd `cmd:"" help:"Summarize message for AI processing"`
	Extract   MailExtractCmd   `cmd:"" help:"Extract structured data from message"`
}

MailCmd handles email operations

type MailDeleteCmd

type MailDeleteCmd struct {
	IDs       []string `arg:"" optional:"" help:"Message ID(s) to delete"`
	Query     string   `help:"Delete messages matching search query (e.g., 'from:spam@example.com')"`
	Mailbox   string   `help:"Mailbox to operate on" short:"m" default:"INBOX"`
	Permanent bool     `help:"Skip trash, delete permanently"`
}

func (*MailDeleteCmd) Run

func (c *MailDeleteCmd) Run(ctx *Context) error

type MailDownloadCmd

type MailDownloadCmd struct {
	ID    string `arg:"" help:"Message ID"`
	Index int    `arg:"" help:"Attachment index (0-based)"`
	Out   string `help:"Output path (default: original filename)" short:"o"`
}

func (*MailDownloadCmd) Run

func (c *MailDownloadCmd) Run(ctx *Context) error

type MailExtractCmd

type MailExtractCmd struct {
	ID      string `arg:"" help:"Message ID to extract data from"`
	Mailbox string `help:"Mailbox name" short:"m" default:"INBOX"`
}

func (*MailExtractCmd) Run

func (c *MailExtractCmd) Run(ctx *Context) error

type MailFlagCmd

type MailFlagCmd struct {
	IDs     []string `arg:"" optional:"" help:"Message ID(s)"`
	Query   string   `help:"Flag messages matching search query (e.g., 'from:user@example.com')"`
	Mailbox string   `help:"Mailbox to operate on" short:"m" default:"INBOX"`
	Read    bool     `help:"Mark as read" xor:"read"`
	Unread  bool     `help:"Mark as unread" xor:"read"`
	Star    bool     `help:"Add star" xor:"star"`
	Unstar  bool     `help:"Remove star" xor:"star"`
}

func (*MailFlagCmd) Run

func (c *MailFlagCmd) Run(ctx *Context) error

type MailForwardCmd

type MailForwardCmd struct {
	ID             string   `arg:"" help:"Message ID to forward"`
	To             []string `help:"Recipient(s)" short:"t" required:""`
	Body           string   `help:"Additional message" short:"b"`
	Attach         []string `help:"Additional attachments" short:"a" type:"existingfile"`
	IdempotencyKey string   `help:"Unique key to prevent duplicate sends" name:"idempotency-key"`
}

func (*MailForwardCmd) Run

func (c *MailForwardCmd) Run(ctx *Context) error

type MailListCmd

type MailListCmd struct {
	Mailbox string `help:"Mailbox name" short:"m" default:"INBOX"`
	Limit   int    `help:"Number of messages" short:"n" default:"20"`
	Offset  int    `help:"Skip first N messages" default:"0"`
	Page    int    `help:"Page number (1-based, combines with limit)" short:"p" default:"0"`
	Unread  bool   `help:"Only show unread messages"`
}

func (*MailListCmd) Run

func (c *MailListCmd) Run(ctx *Context) error

type MailMoveCmd

type MailMoveCmd struct {
	IDs         []string `arg:"" optional:"" help:"Message ID(s) to move"`
	Destination string   `help:"Destination mailbox" short:"d" required:""`
	Query       string   `help:"Move messages matching search query (e.g., 'subject:newsletter')"`
	Mailbox     string   `help:"Source mailbox" short:"m" default:"INBOX"`
}

func (*MailMoveCmd) Run

func (c *MailMoveCmd) Run(ctx *Context) error

type MailReadCmd

type MailReadCmd struct {
	ID          string `arg:"" help:"Message ID or sequence number"`
	Mailbox     string `help:"Mailbox name" short:"m"`
	Raw         bool   `help:"Show raw message"`
	Headers     bool   `help:"Include all headers"`
	Attachments bool   `help:"List attachments"`
	HTML        bool   `help:"Output HTML body instead of plain text"`
}

func (*MailReadCmd) Run

func (c *MailReadCmd) Run(ctx *Context) error

type MailReplyCmd

type MailReplyCmd struct {
	ID             string   `arg:"" help:"Message ID to reply to"`
	All            bool     `help:"Reply to all recipients" name:"all"`
	Body           string   `help:"Reply body" short:"b"`
	Attach         []string `help:"Attachments" short:"a" type:"existingfile"`
	IdempotencyKey string   `help:"Unique key to prevent duplicate sends" name:"idempotency-key"`
}

func (*MailReplyCmd) Run

func (c *MailReplyCmd) Run(ctx *Context) error

type MailSearchCmd

type MailSearchCmd struct {
	Query          string `arg:"" optional:"" help:"Search query (searches body text)"`
	Mailbox        string `help:"Mailbox to search" short:"m" default:"INBOX"`
	From           string `help:"Filter by sender"`
	To             string `help:"Filter by recipient"`
	Subject        string `help:"Filter by subject"`
	Body           string `help:"Search in message body"`
	Since          string `help:"Messages since date (YYYY-MM-DD)"`
	Before         string `help:"Messages before date (YYYY-MM-DD)"`
	HasAttachments bool   `help:"Only messages with attachments" name:"has-attachments"`
	LargerThan     string `help:"Messages larger than size (e.g., 1M, 500K)" name:"larger-than"`
	SmallerThan    string `help:"Messages smaller than size (e.g., 10M, 1K)" name:"smaller-than"`
	And            bool   `help:"Combine filters with AND (default)" name:"and" xor:"logic" default:"true"`
	Or             bool   `help:"Combine filters with OR" name:"or" xor:"logic"`
	Not            bool   `help:"Negate the search query" name:"not"`
}

func (*MailSearchCmd) Run

func (c *MailSearchCmd) Run(ctx *Context) error

type MailSendCmd

type MailSendCmd struct {
	To             []string          `help:"Recipient(s)" short:"t"`
	CC             []string          `help:"CC recipients"`
	BCC            []string          `help:"BCC recipients"`
	Subject        string            `help:"Subject line" short:"s"`
	Body           string            `help:"Body text (or use stdin)" short:"b"`
	Attach         []string          `help:"Attachments" short:"a" type:"existingfile"`
	IdempotencyKey string            `help:"Unique key to prevent duplicate sends" name:"idempotency-key"`
	Template       string            `help:"Template file path" name:"template" type:"existingfile"`
	Vars           map[string]string `help:"Template variables (key=value)" short:"V"`
}

func (*MailSendCmd) Run

func (c *MailSendCmd) Run(ctx *Context) error

type MailSummarizeCmd

type MailSummarizeCmd struct {
	ID      string `arg:"" help:"Message ID to summarize"`
	Mailbox string `help:"Mailbox name" short:"m" default:"INBOX"`
}

func (*MailSummarizeCmd) Run

func (c *MailSummarizeCmd) Run(ctx *Context) error

type MailThreadCmd

type MailThreadCmd struct {
	ID      string `arg:"" help:"Message ID to show thread for"`
	Mailbox string `help:"Mailbox to search" short:"m" default:"INBOX"`
}

func (*MailThreadCmd) Run

func (c *MailThreadCmd) Run(ctx *Context) error

type MailWatchCmd

type MailWatchCmd struct {
	Mailbox  string `help:"Mailbox to watch" short:"m" default:"INBOX"`
	Interval int    `help:"Poll interval in seconds" short:"i" default:"30"`
	Unread   bool   `help:"Only notify for unread messages" default:"true"`
	Exec     string `help:"Command to execute on new mail (use {} for message ID)" short:"e"`
	Once     bool   `help:"Exit after first new message"`
}

func (*MailWatchCmd) Run

func (c *MailWatchCmd) Run(ctx *Context) error

type MailboxCmd

type MailboxCmd struct {
	List   MailboxListCmd   `cmd:"" help:"List all mailboxes/folders"`
	Create MailboxCreateCmd `cmd:"" help:"Create new mailbox"`
	Delete MailboxDeleteCmd `cmd:"" help:"Delete mailbox"`
}

MailboxCmd handles mailbox management

type MailboxCreateCmd

type MailboxCreateCmd struct {
	Name string `arg:"" help:"Mailbox name to create"`
}

func (*MailboxCreateCmd) Run

func (c *MailboxCreateCmd) Run(ctx *Context) error

type MailboxDeleteCmd

type MailboxDeleteCmd struct {
	Name string `arg:"" help:"Mailbox name to delete"`
}

func (*MailboxDeleteCmd) Run

func (c *MailboxDeleteCmd) Run(ctx *Context) error

type MailboxListCmd

type MailboxListCmd struct{}

func (*MailboxListCmd) Run

func (c *MailboxListCmd) Run(ctx *Context) error

type VersionCmd

type VersionCmd struct{}

VersionCmd shows version information

func (*VersionCmd) Run

func (c *VersionCmd) Run(ctx *Context) error

Jump to

Keyboard shortcuts

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