cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

Functions

func Execute

func Execute() int

Types

type AuthCmd

type AuthCmd struct {
	Login  AuthLoginCmd  `cmd:"" help:"Login to a Microsoft account"`
	Logout AuthLogoutCmd `cmd:"" help:"Logout from an account"`
	List   AuthListCmd   `cmd:"" help:"List authenticated accounts"`
	Status AuthStatusCmd `cmd:"" help:"Show authentication status"`
}

type AuthListCmd

type AuthListCmd struct{}

func (*AuthListCmd) Run

func (c *AuthListCmd) Run(ctx *RunContext) error

type AuthLoginCmd

type AuthLoginCmd struct {
	ClientID string `help:"OAuth2 client ID" env:"OLK_CLIENT_ID"`
	TenantID string `help:"Azure AD tenant ID" env:"OLK_TENANT_ID" default:"common"`
	ReadOnly bool   `help:"Request read-only permissions"`
}

func (*AuthLoginCmd) Run

func (c *AuthLoginCmd) Run(ctx *RunContext) error

type AuthLogoutCmd

type AuthLogoutCmd struct {
	Email string `arg:"" optional:"" help:"Account email to logout (default: current account)"`
}

func (*AuthLogoutCmd) Run

func (c *AuthLogoutCmd) Run(ctx *RunContext) error

type AuthStatusCmd

type AuthStatusCmd struct{}

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run(ctx *RunContext) error

type CLI

type CLI struct {
	RootFlags

	Auth     AuthCmd     `cmd:"" help:"Authentication commands"`
	Mail     MailCmd     `cmd:"" help:"Mail commands"`
	Calendar CalendarCmd `cmd:"" help:"Calendar commands"`
	Contacts ContactsCmd `cmd:"" help:"Contacts commands"`
	Version  VersionCmd  `cmd:"" help:"Show version information"`

	// Desire path shortcuts
	Send   SendCmd   `cmd:"" help:"Send an email (shortcut for mail send)" hidden:""`
	Ls     LsCmd     `cmd:"" help:"List inbox (shortcut for mail list)" hidden:""`
	Inbox  InboxCmd  `cmd:"" help:"List inbox (shortcut for mail list)" hidden:""`
	Search SearchCmd `cmd:"" help:"Search mail (shortcut for mail search)" hidden:""`
	Today  TodayCmd  `cmd:"" help:"Today's events (shortcut for calendar events --days 1)" hidden:""`
	Week   WeekCmd   `cmd:"" help:"This week's events (shortcut for calendar events --days 7)" hidden:""`
}

type CalendarCalendarsCmd

type CalendarCalendarsCmd struct{}

func (*CalendarCalendarsCmd) Run

func (c *CalendarCalendarsCmd) Run(ctx *RunContext) error

type CalendarCmd

type CalendarCmd struct {
	Events    CalendarEventsCmd    `cmd:"" help:"List calendar events"`
	Get       CalendarGetCmd       `cmd:"" help:"Get event details"`
	Create    CalendarCreateCmd    `cmd:"" help:"Create a calendar event"`
	Update    CalendarUpdateCmd    `cmd:"" help:"Update a calendar event"`
	Delete    CalendarDeleteCmd    `cmd:"" help:"Delete a calendar event"`
	Respond   CalendarRespondCmd   `cmd:"" help:"Respond to an event invitation"`
	Calendars CalendarCalendarsCmd `cmd:"" help:"List available calendars"`
}

type CalendarCreateCmd

type CalendarCreateCmd struct {
	Subject       string   `help:"Event subject" required:"" short:"s"`
	Start         string   `help:"Start time (ISO 8601)" required:""`
	End           string   `help:"End time (ISO 8601)" required:""`
	Location      string   `help:"Event location" short:"l"`
	Attendees     []string `help:"Attendee email addresses" short:"a"`
	AllDay        bool     `help:"All-day event"`
	OnlineMeeting bool     `help:"Create online meeting"`
}

func (*CalendarCreateCmd) Run

func (c *CalendarCreateCmd) Run(ctx *RunContext) error

type CalendarDeleteCmd

type CalendarDeleteCmd struct {
	ID string `arg:"" help:"Event ID"`
}

func (*CalendarDeleteCmd) Run

func (c *CalendarDeleteCmd) Run(ctx *RunContext) error

type CalendarEventsCmd

type CalendarEventsCmd struct {
	Days     int    `help:"Number of days to look ahead" default:"7" short:"d"`
	After    string `help:"Start date (ISO 8601)"`
	Before   string `help:"End date (ISO 8601)"`
	Calendar string `help:"Calendar ID"`
	Top      int32  `help:"Max events to return" default:"25" short:"n"`
}

func (*CalendarEventsCmd) Run

func (c *CalendarEventsCmd) Run(ctx *RunContext) error

type CalendarGetCmd

type CalendarGetCmd struct {
	ID string `arg:"" help:"Event ID"`
}

func (*CalendarGetCmd) Run

func (c *CalendarGetCmd) Run(ctx *RunContext) error

type CalendarRespondCmd

type CalendarRespondCmd struct {
	ID       string `arg:"" help:"Event ID"`
	Response string `arg:"" help:"Response: accept|decline|tentative" enum:"accept,decline,tentative"`
}

func (*CalendarRespondCmd) Run

func (c *CalendarRespondCmd) Run(ctx *RunContext) error

type CalendarUpdateCmd

type CalendarUpdateCmd struct {
	ID       string `arg:"" help:"Event ID"`
	Subject  string `help:"New subject" short:"s"`
	Start    string `help:"New start time (ISO 8601)"`
	End      string `help:"New end time (ISO 8601)"`
	Location string `help:"New location" short:"l"`
}

func (*CalendarUpdateCmd) Run

func (c *CalendarUpdateCmd) Run(ctx *RunContext) error

type ContactsCmd

type ContactsCmd struct {
	List   ContactsListCmd   `cmd:"" help:"List contacts"`
	Get    ContactsGetCmd    `cmd:"" help:"Get contact details"`
	Create ContactsCreateCmd `cmd:"" help:"Create a contact"`
	Update ContactsUpdateCmd `cmd:"" help:"Update a contact"`
	Delete ContactsDeleteCmd `cmd:"" help:"Delete a contact"`
	Search ContactsSearchCmd `cmd:"" help:"Search contacts"`
}

type ContactsCreateCmd

type ContactsCreateCmd struct {
	FirstName string `help:"First name" required:""`
	LastName  string `help:"Last name" required:""`
	Email     string `help:"Email address" short:"e"`
	Phone     string `help:"Phone number" short:"p"`
	Company   string `help:"Company name" short:"c"`
	Title     string `help:"Job title"`
}

func (*ContactsCreateCmd) Run

func (c *ContactsCreateCmd) Run(ctx *RunContext) error

type ContactsDeleteCmd

type ContactsDeleteCmd struct {
	ID string `arg:"" help:"Contact ID"`
}

func (*ContactsDeleteCmd) Run

func (c *ContactsDeleteCmd) Run(ctx *RunContext) error

type ContactsGetCmd

type ContactsGetCmd struct {
	ID string `arg:"" help:"Contact ID"`
}

func (*ContactsGetCmd) Run

func (c *ContactsGetCmd) Run(ctx *RunContext) error

type ContactsListCmd

type ContactsListCmd struct {
	Top int32 `help:"Max contacts to return" default:"25" short:"n"`
}

func (*ContactsListCmd) Run

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

type ContactsSearchCmd

type ContactsSearchCmd struct {
	Query string `arg:"" help:"Search query"`
	Top   int32  `help:"Max results" default:"25" short:"n"`
}

func (*ContactsSearchCmd) Run

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

type ContactsUpdateCmd

type ContactsUpdateCmd struct {
	ID        string `arg:"" help:"Contact ID"`
	FirstName string `help:"First name"`
	LastName  string `help:"Last name"`
	Email     string `help:"Email address" short:"e"`
	Phone     string `help:"Phone number" short:"p"`
	Company   string `help:"Company name" short:"c"`
	Title     string `help:"Job title"`
}

func (*ContactsUpdateCmd) Run

func (c *ContactsUpdateCmd) Run(ctx *RunContext) error

type InboxCmd

type InboxCmd struct {
	Top    int32 `help:"Number of messages" default:"25" short:"n"`
	Unread bool  `help:"Unread only" short:"u"`
}

InboxCmd is a shortcut for `olk mail list`

func (*InboxCmd) Run

func (c *InboxCmd) Run(ctx *RunContext) error

type LsCmd

type LsCmd struct {
	Folder string `help:"Mail folder" short:"f"`
	Top    int32  `help:"Number of messages" default:"25" short:"n"`
	Unread bool   `help:"Unread only" short:"u"`
}

LsCmd is a shortcut for `olk mail list`

func (*LsCmd) Run

func (c *LsCmd) Run(ctx *RunContext) error

type MailAttachmentsCmd

type MailAttachmentsCmd struct {
	ID string `arg:"" help:"Message ID"`
}

func (*MailAttachmentsCmd) Run

func (c *MailAttachmentsCmd) Run(ctx *RunContext) error

type MailCmd

type MailCmd struct {
	List        MailListCmd        `cmd:"" help:"List messages in inbox"`
	Get         MailGetCmd         `cmd:"" help:"Get a message"`
	Send        MailSendCmd        `cmd:"" help:"Send a message"`
	Search      MailSearchCmd      `cmd:"" help:"Search messages"`
	Reply       MailReplyCmd       `cmd:"" help:"Reply to a message"`
	Forward     MailForwardCmd     `cmd:"" help:"Forward a message"`
	Move        MailMoveCmd        `cmd:"" help:"Move a message to a folder"`
	Delete      MailDeleteCmd      `cmd:"" help:"Delete a message"`
	Mark        MailMarkCmd        `cmd:"" help:"Mark message as read/unread"`
	Folders     MailFoldersCmd     `cmd:"" help:"List mail folders"`
	Attachments MailAttachmentsCmd `cmd:"" help:"List/download attachments"`
}

type MailDeleteCmd

type MailDeleteCmd struct {
	ID string `arg:"" help:"Message ID"`
}

func (*MailDeleteCmd) Run

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

type MailFoldersCmd

type MailFoldersCmd struct{}

func (*MailFoldersCmd) Run

func (c *MailFoldersCmd) Run(ctx *RunContext) error

type MailForwardCmd

type MailForwardCmd struct {
	ID      string   `arg:"" help:"Message ID to forward"`
	To      []string `help:"Recipient email addresses" required:"" short:"t"`
	Comment string   `help:"Comment to include" short:"c"`
}

func (*MailForwardCmd) Run

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

type MailGetCmd

type MailGetCmd struct {
	ID     string `arg:"" help:"Message ID"`
	Format string `help:"Output format: full|text|html" default:"full" enum:"full,text,html"`
}

func (*MailGetCmd) Run

func (c *MailGetCmd) Run(ctx *RunContext) error

type MailListCmd

type MailListCmd struct {
	Folder string `help:"Mail folder ID or well-known name" short:"f" env:"OLK_MAIL_FOLDER"`
	Top    int32  `help:"Number of messages to return" default:"25" short:"n"`
	Unread bool   `help:"Show only unread messages" short:"u"`
	From   string `help:"Filter by sender email"`
	After  string `help:"Filter messages after date (ISO 8601)"`
	Before string `help:"Filter messages before date (ISO 8601)"`
}

func (*MailListCmd) Run

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

type MailMarkCmd

type MailMarkCmd struct {
	ID     string `arg:"" help:"Message ID"`
	Read   bool   `help:"Mark as read" xor:"state"`
	Unread bool   `help:"Mark as unread" xor:"state"`
}

func (*MailMarkCmd) Run

func (c *MailMarkCmd) Run(ctx *RunContext) error

type MailMoveCmd

type MailMoveCmd struct {
	ID     string `arg:"" help:"Message ID"`
	Folder string `arg:"" help:"Destination folder ID or well-known name"`
}

func (*MailMoveCmd) Run

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

type MailReplyCmd

type MailReplyCmd struct {
	ID       string `arg:"" help:"Message ID to reply to"`
	Body     string `help:"Reply body" required:"" short:"b"`
	ReplyAll bool   `help:"Reply to all recipients" short:"a"`
}

func (*MailReplyCmd) Run

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

type MailSearchCmd

type MailSearchCmd struct {
	Query string `arg:"" help:"Search query (KQL syntax)"`
	Top   int32  `help:"Number of results" default:"25" short:"n"`
}

func (*MailSearchCmd) Run

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

type MailSendCmd

type MailSendCmd struct {
	To      []string `help:"Recipient email addresses" required:"" short:"t"`
	Subject string   `help:"Email subject" required:"" short:"s"`
	Body    string   `help:"Email body" short:"b"`
	CC      []string `help:"CC recipients"`
	BCC     []string `help:"BCC recipients"`
	HTML    bool     `help:"Send body as HTML"`
}

func (*MailSendCmd) Run

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

type RootFlags

type RootFlags struct {
	JSON        bool   `help:"Output as JSON" env:"OLK_JSON"`
	Plain       bool   `help:"Output as plain TSV" env:"OLK_PLAIN"`
	Account     string `help:"Account email to use" env:"OLK_ACCOUNT"`
	Verbose     bool   `help:"Verbose output" short:"v" env:"OLK_VERBOSE"`
	DryRun      bool   `help:"Dry run mode" env:"OLK_DRY_RUN"`
	Force       bool   `help:"Force operation" env:"OLK_FORCE"`
	Color       string `help:"Color mode: auto|never|always" default:"auto" env:"OLK_COLOR" enum:"auto,never,always"`
	Select      string `help:"Comma-separated fields to output" env:"OLK_SELECT"`
	ResultsOnly bool   `help:"Output only the results array (no envelope)" env:"OLK_RESULTS_ONLY"`
	Timeout     int    `help:"Request timeout in seconds" default:"60" env:"OLK_TIMEOUT"`
}

type RunContext

type RunContext struct {
	Ctx   context.Context
	Flags *RootFlags
	// contains filtered or unexported fields
}

func (*RunContext) Authenticator

func (r *RunContext) Authenticator(clientID, tenantID string) (*msauth.Authenticator, error)

Authenticator returns the auth manager

func (*RunContext) Config

func (r *RunContext) Config() (*config.Config, error)

Config returns the config, loading if needed

func (*RunContext) GraphClient

func (r *RunContext) GraphClient() (*graphapi.Client, error)

GraphClient returns the Graph API client for the active account

func (*RunContext) Printer

func (r *RunContext) Printer() *outfmt.Printer

Printer returns an output printer based on flags

func (*RunContext) Store

func (r *RunContext) Store() (secrets.Store, error)

Store returns the keyring store, initializing if needed

type SearchCmd

type SearchCmd struct {
	Query string `arg:"" help:"Search query"`
	Top   int32  `help:"Max results" default:"25" short:"n"`
}

SearchCmd is a shortcut for `olk mail search`

func (*SearchCmd) Run

func (c *SearchCmd) Run(ctx *RunContext) error

type SendCmd

type SendCmd struct {
	To      []string `help:"Recipient email addresses" required:"" short:"t"`
	Subject string   `help:"Email subject" required:"" short:"s"`
	Body    string   `help:"Email body" short:"b"`
	CC      []string `help:"CC recipients"`
	BCC     []string `help:"BCC recipients"`
	HTML    bool     `help:"Send body as HTML"`
}

SendCmd is a shortcut for `olk mail send`

func (*SendCmd) Run

func (c *SendCmd) Run(ctx *RunContext) error

type TodayCmd

type TodayCmd struct {
	Top int32 `help:"Max events" default:"25" short:"n"`
}

TodayCmd is a shortcut for `olk calendar events --days 1`

func (*TodayCmd) Run

func (c *TodayCmd) Run(ctx *RunContext) error

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

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

type WeekCmd

type WeekCmd struct {
	Top int32 `help:"Max events" default:"25" short:"n"`
}

WeekCmd is a shortcut for `olk calendar events --days 7`

func (*WeekCmd) Run

func (c *WeekCmd) Run(ctx *RunContext) error

Jump to

Keyboard shortcuts

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