Help us shape the future of Go! Take the 2026 Go Developer Survey

cmd

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 32 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 AuthCleanCmd added in v0.2.0

type AuthCleanCmd struct{}

func (*AuthCleanCmd) Run added in v0.2.0

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

type AuthCmd

type AuthCmd struct {
	Login  AuthLoginCmd  `cmd:"" help:"Login to a Microsoft account"`
	Logout AuthLogoutCmd `cmd:"" help:"Logout from an account"`
	Clean  AuthCleanCmd  `cmd:"" help:"Remove all stored accounts and tokens"`
	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"`
	Enterprise bool     `help:"Request enterprise scopes (work/school accounts)" env:"OLK_ENTERPRISE"`
	Browser    bool     `help:"Sign in via the system browser (auth-code + PKCE) instead of device code" env:"OLK_BROWSER"`
	Scope      []string `help:"Additional OAuth scopes to request (repeatable, e.g. --scope Mail.Read.Shared)" name:"scope"`
}

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"`
	Todo     TodoCmd     `cmd:"" help:"Microsoft To Do tasks"`
	People   PeopleCmd   `cmd:"" help:"People directory search"`
	Drive    DriveCmd    `cmd:"" help:"OneDrive file operations"`
	Config   ConfigCmd   `cmd:"" help:"Configuration management"`
	MCP      MCPCmd      `cmd:"" name:"mcp" help:"Run an MCP server exposing olk as tools (stdio)"`
	Version  VersionCmd  `cmd:"" help:"Show version information"`
	Whoami   WhoamiCmd   `cmd:"" help:"Show current user profile"`
	Changes  ChangesCmd  `cmd:"" help:"Unified delta digest across mail, calendar, and contacts"`

	// 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 CalendarAttachmentsAddCmd added in v1.14.0

type CalendarAttachmentsAddCmd struct {
	EventID string `arg:"" help:"Event ID"`
	File    string `arg:"" help:"File to upload" type:"existingfile"`
}

CalendarAttachmentsAddCmd adds a small file attachment to an event.

func (*CalendarAttachmentsAddCmd) Run added in v1.14.0

type CalendarAttachmentsCmd added in v1.14.0

type CalendarAttachmentsCmd struct {
	List     CalendarAttachmentsListCmd     `cmd:"" help:"List event attachments"`
	Add      CalendarAttachmentsAddCmd      `cmd:"" help:"Add a file attachment"`
	Download CalendarAttachmentsDownloadCmd `cmd:"" help:"Download an attachment"`
	Delete   CalendarAttachmentsDeleteCmd   `cmd:"" help:"Delete an attachment"`
}

CalendarAttachmentsCmd manages file attachments on calendar events.

type CalendarAttachmentsDeleteCmd added in v1.14.0

type CalendarAttachmentsDeleteCmd struct {
	EventID      string `arg:"" help:"Event ID"`
	AttachmentID string `arg:"" help:"Attachment ID"`
}

CalendarAttachmentsDeleteCmd deletes an attachment from an event.

func (*CalendarAttachmentsDeleteCmd) Run added in v1.14.0

type CalendarAttachmentsDownloadCmd added in v1.14.0

type CalendarAttachmentsDownloadCmd struct {
	EventID      string `arg:"" help:"Event ID"`
	AttachmentID string `arg:"" help:"Attachment ID"`
	Out          string `help:"Output directory for download" default:"." type:"path"`
}

CalendarAttachmentsDownloadCmd downloads an attachment from an event.

func (*CalendarAttachmentsDownloadCmd) Run added in v1.14.0

type CalendarAttachmentsListCmd added in v1.14.0

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

CalendarAttachmentsListCmd lists attachments on an event.

func (*CalendarAttachmentsListCmd) Run added in v1.14.0

type CalendarAvailabilityCmd added in v0.2.0

type CalendarAvailabilityCmd struct {
	Emails []string `help:"Email addresses to check" required:"" short:"e"`
	Days   int      `help:"Days to look ahead" default:"1" short:"d"`
	After  string   `help:"Start date (ISO 8601)"`
	Before string   `help:"End date (ISO 8601)"`
}

CalendarAvailabilityCmd checks free/busy availability for one or more users

func (*CalendarAvailabilityCmd) Run added in v0.2.0

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"`
	Delta        CalendarDeltaCmd        `cmd:"" help:"Incremental sync of calendar events (delta)"`
	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"`
	Attachments  CalendarAttachmentsCmd  `cmd:"" help:"Event attachment operations"`
	Availability CalendarAvailabilityCmd `cmd:"" help:"Check availability / free-busy"`
	View         CalendarViewCmd         `cmd:"" help:"Calendar view with expanded recurring events"`
	FindTimes    CalendarFindTimesCmd    `cmd:"" help:"Find available meeting times" name:"find-times"`
}

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:""`
	Calendar        string   `help:"Calendar ID (default calendar when omitted)"`
	Location        string   `help:"Event location" short:"l"`
	Attendees       []string `help:"Attendee email addresses" short:"a"`
	AllDay          bool     `help:"All-day event"`
	EventTimeZone   string   `help:"Named time zone for all-day boundaries (e.g. America/Los_Angeles)" name:"event-timezone"`
	OnlineMeeting   bool     `help:"Create online meeting"`
	Recurrence      string   `help:"Recurrence: daily|weekdays|weekly|monthly|yearly" short:"r"`
	TransactionID   string   `help:"Retry-safe provider transaction ID" name:"transaction-id"`
	NoReminder      bool     `help:"Disable event reminders" name:"no-reminder"`
	ReminderMinutes *int32   `help:"Enable reminder this many minutes before the event" name:"reminder-minutes"`
	Body            *string  `help:"Event body" short:"b"`
	HTML            bool     `help:"Treat --body as HTML"`
}

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 CalendarDeltaCmd added in v1.9.6

type CalendarDeltaCmd struct {
	Days   int    `help:"Window size in days ahead for the initial sync" default:"30" short:"d"`
	After  string `help:"Window start (ISO 8601); overrides --days start"`
	Before string `help:"Window end (ISO 8601); overrides --days end"`
	Token  string `help:"Delta token from a previous call (omit to start a fresh sync)"`
	Top    int32  `help:"Max items per page" short:"n"`
}

CalendarDeltaCmd performs an incremental sync of calendar events via Graph's calendarView delta endpoint. The window (--days/--after/--before) applies to the initial sync only; on resume the token already encodes it.

func (*CalendarDeltaCmd) Run added in v1.9.6

func (c *CalendarDeltaCmd) 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"`
	BodyFormat *string `help:"Request provider-returned event body representation" enum:"text,html"`
}

func (*CalendarEventsCmd) Run

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

type CalendarFindTimesCmd added in v0.3.0

type CalendarFindTimesCmd struct {
	Attendees []string `help:"Attendee email addresses" required:"" short:"a"`
	Duration  int32    `help:"Meeting duration in minutes" default:"60" short:"d"`
	After     string   `help:"Search after date (ISO 8601)"`
	Before    string   `help:"Search before date (ISO 8601)"`
}

func (*CalendarFindTimesCmd) Run added in v0.3.0

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

type CalendarGetCmd

type CalendarGetCmd struct {
	ID         string  `arg:"" help:"Event ID"`
	BodyFormat *string `help:"Request provider-returned event body representation" enum:"text,html"`
}

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"`
	AllDay          *bool   `help:"Convert event to an all-day event" name:"all-day"`
	Timed           *bool   `help:"Convert event to a timed event"`
	EventTimeZone   string  `help:"Named time zone for all-day boundaries (e.g. America/Los_Angeles)" name:"event-timezone"`
	NoReminder      bool    `help:"Disable event reminders" name:"no-reminder"`
	ReminderMinutes *int32  `help:"Enable reminder this many minutes before the event" name:"reminder-minutes"`
	Body            *string `help:"Replace event body" short:"b"`
	HTML            bool    `help:"Treat --body as HTML"`
	ClearBody       bool    `help:"Clear the event body" name:"clear-body"`
}

func (*CalendarUpdateCmd) Run

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

type CalendarViewCmd added in v0.3.0

type CalendarViewCmd struct {
	Days       int     `help:"Number of days to show" 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:"50" short:"n"`
	BodyFormat *string `help:"Request provider-returned event body representation" enum:"text,html"`
}

func (*CalendarViewCmd) Run added in v0.3.0

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

type ChangesCmd added in v1.9.6

type ChangesCmd struct {
	MailToken     string `help:"Delta token for mail (omit for a fresh sync)" name:"mail-token"`
	CalendarToken string `help:"Delta token for calendar (omit for a fresh sync)" name:"calendar-token"`
	ContactsToken string `help:"Delta token for contacts (omit for a fresh sync)" name:"contacts-token"`
	Days          int    `help:"Calendar window in days ahead for the initial sync" default:"30"`
	Top           int32  `help:"Max items per resource page" short:"n"`
}

ChangesCmd returns a unified digest of mail, calendar, and contacts changes in one call, each with its own delta token. Omit a token for that resource's initial sync; pass it back next time to get only what changed.

func (*ChangesCmd) Run added in v1.9.6

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

type ConfigCmd added in v0.6.0

type ConfigCmd struct {
	Set ConfigSetCmd `cmd:"" help:"Set a configuration value"`
	Get ConfigGetCmd `cmd:"" help:"Get a configuration value"`
}

ConfigCmd manages persistent configuration settings.

type ConfigGetCmd added in v0.6.0

type ConfigGetCmd struct {
	Key string `arg:"" help:"Configuration key (e.g. timezone)" enum:"timezone"`
}

ConfigGetCmd reads a configuration key.

func (*ConfigGetCmd) Run added in v0.6.0

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

type ConfigSetCmd added in v0.6.0

type ConfigSetCmd struct {
	Key   string `arg:"" help:"Configuration key (e.g. timezone)" enum:"timezone"`
	Value string `arg:"" help:"Value to set"`
}

ConfigSetCmd sets a configuration key.

func (*ConfigSetCmd) Run added in v0.6.0

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

type ContactsCmd

type ContactsCmd struct {
	List   ContactsListCmd   `cmd:"" help:"List contacts"`
	Delta  ContactsDeltaCmd  `cmd:"" help:"Incremental sync of contacts (delta)"`
	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:""`
	MiddleName    string   `help:"Middle name" name:"middle-name"`
	NickName      string   `help:"Nickname" name:"nickname"`
	Email         []string `help:"Email address (repeatable)" short:"e"`
	MobilePhone   string   `help:"Mobile phone number" short:"p" name:"mobile-phone"`
	BusinessPhone string   `help:"Business phone number" name:"business-phone"`
	HomePhone     string   `help:"Home phone number" name:"home-phone"`
	Company       string   `help:"Company name" short:"c"`
	Title         string   `help:"Job title"`
	Department    string   `help:"Department" short:"d"`
	Manager       string   `help:"Manager name"`
	Birthday      string   `help:"Birthday (YYYY-MM-DD)"`
	Notes         string   `help:"Personal notes"`
	Categories    []string `help:"Category (repeatable)" short:"g"`
	Street        string   `help:"Street address"`
	City          string   `help:"City"`
	State         string   `help:"State or province"`
	PostalCode    string   `help:"Postal code" name:"postal-code"`
	Country       string   `help:"Country or region"`
	AddressType   string   `help:"Which address to set" enum:"business,home,other" default:"business" name:"address-type"`
}

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 ContactsDeltaCmd added in v1.9.6

type ContactsDeltaCmd struct {
	Token string `help:"Delta token from a previous call (omit to start a fresh sync)"`
	Top   int32  `help:"Max items per page" short:"n"`
}

ContactsDeltaCmd performs an incremental sync of contacts via Graph's delta endpoint. Omit --token for a fresh sync; pass the returned token next time.

func (*ContactsDeltaCmd) Run added in v1.9.6

func (c *ContactsDeltaCmd) 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"`
	Skip int32  `help:"Number of contacts to skip (offset pagination)" default:"0"`
	Sort string `help:"Sort by field" enum:"displayName,givenName,surname," default:""`
}

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"`
	MiddleName    string   `help:"Middle name ('none' to clear)" name:"middle-name"`
	NickName      string   `help:"Nickname ('none' to clear)" name:"nickname"`
	Email         []string `help:"Email address (repeatable, replaces all; 'none' to clear)" short:"e"`
	MobilePhone   string   `help:"Mobile phone number ('none' to clear)" short:"p" name:"mobile-phone"`
	BusinessPhone string   `help:"Business phone number ('none' to clear)" name:"business-phone"`
	HomePhone     string   `help:"Home phone number ('none' to clear)" name:"home-phone"`
	Company       string   `help:"Company name ('none' to clear)" short:"c"`
	Title         string   `help:"Job title ('none' to clear)"`
	Department    string   `help:"Department ('none' to clear)" short:"d"`
	Manager       string   `help:"Manager name ('none' to clear)"`
	Birthday      string   `help:"Birthday (YYYY-MM-DD, 'none' to clear)"`
	Notes         string   `help:"Personal notes ('none' to clear)"`
	Categories    []string `help:"Category (repeatable, replaces all; 'none' to clear)" short:"g"`
	Street        string   `help:"Street address ('none' to clear)"`
	City          string   `help:"City ('none' to clear)"`
	State         string   `help:"State or province ('none' to clear)"`
	PostalCode    string   `help:"Postal code ('none' to clear)" name:"postal-code"`
	Country       string   `help:"Country or region ('none' to clear)"`
	AddressType   string   `help:"Which address to set" enum:"business,home,other" default:"business" name:"address-type"`
}

func (*ContactsUpdateCmd) Run

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

type DriveCmd added in v0.8.0

type DriveCmd struct {
	List     DriveListCmd     `cmd:"" help:"List all drives"`
	Info     DriveInfoCmd     `cmd:"" help:"Show drive details and quota"`
	Ls       DriveLsCmd       `cmd:"" help:"List folder contents"`
	Get      DriveGetCmd      `cmd:"" help:"Get item details"`
	Search   DriveSearchCmd   `cmd:"" help:"Search files"`
	Recent   DriveRecentCmd   `cmd:"" help:"Recently accessed files"`
	Shared   DriveSharedCmd   `cmd:"" help:"Files shared with me"`
	Download DriveDownloadCmd `cmd:"" help:"Download a file"`
	Upload   DriveUploadCmd   `cmd:"" help:"Upload a file"`
	Mkdir    DriveMkdirCmd    `cmd:"" help:"Create a folder"`
	Cp       DriveCpCmd       `cmd:"" help:"Copy a file or folder"`
	Mv       DriveMvCmd       `cmd:"" help:"Move or rename a file or folder"`
	Rm       DriveRmCmd       `cmd:"" help:"Delete a file or folder"`
	Share    DriveShareCmd    `cmd:"" help:"Create a sharing link"`
	Versions DriveVersionsCmd `cmd:"" help:"List file version history"`
}

DriveCmd is the top-level command group for OneDrive file operations.

type DriveCpCmd added in v0.8.0

type DriveCpCmd struct {
	ItemID  string `arg:"" help:"Source item ID"`
	Dest    string `arg:"" help:"Destination folder path"`
	Name    string `help:"New name for the copy" short:"n"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveCpCmd copies a file or folder.

func (*DriveCpCmd) Run added in v0.8.0

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

type DriveDownloadCmd added in v0.8.0

type DriveDownloadCmd struct {
	ID      string `arg:"" help:"Item ID"`
	Output  string `help:"Output directory" short:"o" default:"." type:"path"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveDownloadCmd downloads a file.

func (*DriveDownloadCmd) Run added in v0.8.0

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

type DriveGetCmd added in v0.8.0

type DriveGetCmd struct {
	ID      string `arg:"" help:"Item ID"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveGetCmd gets item details.

func (*DriveGetCmd) Run added in v0.8.0

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

type DriveInfoCmd added in v0.8.0

type DriveInfoCmd struct {
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveInfoCmd shows drive details and quota.

func (*DriveInfoCmd) Run added in v0.8.0

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

type DriveListCmd added in v0.8.0

type DriveListCmd struct{}

DriveListCmd lists all drives for the current user.

func (*DriveListCmd) Run added in v0.8.0

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

type DriveLsCmd added in v0.8.0

type DriveLsCmd struct {
	Path    string `arg:"" optional:"" help:"Folder path (default: root)" default:"/"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
	Top     int32  `help:"Number of items to return" default:"50" short:"n"`
}

DriveLsCmd lists folder contents.

func (*DriveLsCmd) Run added in v0.8.0

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

type DriveMkdirCmd added in v0.8.0

type DriveMkdirCmd struct {
	Path    string `arg:"" help:"Folder path to create (e.g. /Documents/NewFolder)"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveMkdirCmd creates a folder.

func (*DriveMkdirCmd) Run added in v0.8.0

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

type DriveMvCmd added in v0.8.0

type DriveMvCmd struct {
	ItemID  string `arg:"" help:"Item ID to move or rename"`
	Dest    string `arg:"" help:"Destination folder path or new name"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveMvCmd moves or renames a file or folder.

func (*DriveMvCmd) Run added in v0.8.0

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

type DriveRecentCmd added in v0.8.0

type DriveRecentCmd struct {
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveRecentCmd lists recently accessed files.

func (*DriveRecentCmd) Run added in v0.8.0

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

type DriveRmCmd added in v0.8.0

type DriveRmCmd struct {
	ID      string `arg:"" help:"Item ID to delete"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveRmCmd deletes a file or folder.

func (*DriveRmCmd) Run added in v0.8.0

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

type DriveSearchCmd added in v0.8.0

type DriveSearchCmd struct {
	Query   string `arg:"" help:"Search query"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
	Top     int32  `help:"Number of results" default:"25" short:"n"`
}

DriveSearchCmd searches files by name or content.

func (*DriveSearchCmd) Run added in v0.8.0

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

type DriveShareCmd added in v0.8.0

type DriveShareCmd struct {
	ID      string `arg:"" help:"Item ID"`
	Type    string `help:"Link type" enum:"view,edit" default:"view" short:"t"`
	Scope   string `help:"Link scope" enum:"anonymous,organization" default:"anonymous" short:"s"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveShareCmd creates a sharing link for an item.

func (*DriveShareCmd) Run added in v0.8.0

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

type DriveSharedCmd added in v0.8.0

type DriveSharedCmd struct {
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveSharedCmd lists files shared with the current user.

func (*DriveSharedCmd) Run added in v0.8.0

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

type DriveUploadCmd added in v0.8.0

type DriveUploadCmd struct {
	LocalPath  string `arg:"" help:"Local file path" type:"existingfile"`
	RemotePath string `arg:"" help:"Remote path (e.g. /Documents/report.pdf)"`
	DriveID    string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
	Replace    bool   `help:"Replace existing file" default:"false"`
}

DriveUploadCmd uploads a file.

func (*DriveUploadCmd) Run added in v0.8.0

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

type DriveVersionsCmd added in v0.8.0

type DriveVersionsCmd struct {
	ID      string `arg:"" help:"Item ID"`
	DriveID string `help:"Drive ID (default: primary drive)" name:"drive-id" env:"OLK_DRIVE_ID"`
}

DriveVersionsCmd lists version history for a file.

func (*DriveVersionsCmd) Run added in v0.8.0

func (c *DriveVersionsCmd) 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 MCPCmd added in v0.9.0

type MCPCmd struct {
	AllowWrite       []string `` /* 162-byte string literal not displayed */
	AllowSend        []string `` /* 226-byte string literal not displayed */
	AllowDestructive []string `` /* 210-byte string literal not displayed */
	AllowTool        []string `` /* 229-byte string literal not displayed */
	MaxOutputBytes   int      `` /* 159-byte string literal not displayed */
	AllowMailbox     []string `` /* 235-byte string literal not displayed */
}

MCPCmd runs a stdio MCP server exposing a curated, read-first set of olk commands as typed tools — there is no arbitrary command bridge. The server is read-only by default; write tools are exposed only when named explicitly via --allow-write (defense in depth: opting into MCP and naming each write tool are two separate, conscious actions). There is intentionally no HTTP transport.

Tool calls are executed in-process and serialized (one at a time), because capturing command output requires temporarily redirecting the process stdout.

func (*MCPCmd) Run added in v0.9.0

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

type MailAttachmentsCmd

type MailAttachmentsCmd struct {
	ID           string `arg:"" help:"Message ID"`
	Save         bool   `help:"Download all attachments" default:"false"`
	Out          string `help:"Output directory for downloads" default:"." type:"path"`
	AttachmentID string `help:"Download a specific attachment by ID" name:"attachment-id"`
}

func (*MailAttachmentsCmd) Run

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

type MailBatchCmd added in v1.9.6

type MailBatchCmd struct {
	ID         []string `help:"Message ID to fetch (repeatable, max 20)" name:"id"`
	BodyFormat *string  `help:"Request provider-returned message body representation" enum:"text,html"`
}

MailBatchCmd fetches up to 20 messages by ID in one Graph $batch round-trip.

func (*MailBatchCmd) Run added in v1.9.6

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

type MailCategoriesCmd added in v0.4.5

type MailCategoriesCmd struct {
	List   MailCategoriesListCmd   `cmd:"" help:"List available categories"`
	Create MailCategoriesCreateCmd `cmd:"" help:"Create a category"`
	Delete MailCategoriesDeleteCmd `cmd:"" help:"Delete a category"`
}

MailCategoriesCmd manages the master category list

type MailCategoriesCreateCmd added in v0.4.5

type MailCategoriesCreateCmd struct {
	Name  string `help:"Category name" required:"" short:"n"`
	Color string `name:"preset" help:"Color preset: none, preset0 through preset24" default:""`
}

MailCategoriesCreateCmd creates a new category

func (*MailCategoriesCreateCmd) Run added in v0.4.5

type MailCategoriesDeleteCmd added in v0.4.5

type MailCategoriesDeleteCmd struct {
	ID string `arg:"" help:"Category ID"`
}

MailCategoriesDeleteCmd deletes a category

func (*MailCategoriesDeleteCmd) Run added in v0.4.5

type MailCategoriesListCmd added in v0.4.5

type MailCategoriesListCmd struct{}

MailCategoriesListCmd lists all master categories

func (*MailCategoriesListCmd) Run added in v0.4.5

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

type MailCategorizeCmd added in v0.2.0

type MailCategorizeCmd struct {
	ID         string   `arg:"" help:"Message ID"`
	Categories []string `help:"Category names" required:"" short:"c"`
}

MailCategorizeCmd sets categories on a message

func (*MailCategorizeCmd) Run added in v0.2.0

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

type MailCmd

type MailCmd struct {
	List        MailListCmd        `cmd:"" help:"List messages in inbox"`
	Delta       MailDeltaCmd       `cmd:"" help:"Incremental sync of a mail folder (delta)"`
	Get         MailGetCmd         `cmd:"" help:"Get a message"`
	Batch       MailBatchCmd       `cmd:"" help:"Fetch up to 20 messages by ID in one request ($batch)"`
	Thread      MailThreadCmd      `cmd:"" help:"List all messages in a conversation thread"`
	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:"Mail folder operations"`
	Attachments MailAttachmentsCmd `cmd:"" help:"List/download attachments"`
	Drafts      MailDraftsCmd      `cmd:"" help:"Draft message operations"`
	Flag        MailFlagCmd        `cmd:"" help:"Set follow-up flag on a message"`
	Importance  MailImportanceCmd  `cmd:"" help:"Set importance on a message"`
	Categorize  MailCategorizeCmd  `cmd:"" help:"Set categories on a message"`
	Categories  MailCategoriesCmd  `cmd:"" help:"Manage category definitions"`
	OOO         MailOOOCmd         `cmd:"" help:"Out-of-office / auto-reply settings"`
	Rules       MailRulesCmd       `cmd:"" help:"Inbox rules"`
}

type MailDeleteCmd

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

func (*MailDeleteCmd) Run

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

type MailDeltaCmd added in v1.9.6

type MailDeltaCmd struct {
	Folder string `help:"Mail folder ID, well-known name, or path (for example Inbox/2026)" short:"f" default:"inbox"`
	Token  string `help:"Delta token from a previous call (omit to start a fresh sync)"`
	Top    int32  `help:"Max items per page" short:"n"`
}

MailDeltaCmd performs an incremental sync of a mail folder via Graph's delta endpoint. Omit --token for a fresh sync; pass the returned token next time to get only what changed since.

func (*MailDeltaCmd) Run added in v1.9.6

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

type MailDraftsAttachCmd added in v1.14.0

type MailDraftsAttachCmd struct {
	ID   string `arg:"" help:"Draft message ID"`
	File string `arg:"" help:"File to attach (under 3 MB)" type:"existingfile"`
}

MailDraftsAttachCmd adds a regular file attachment to an existing draft.

func (*MailDraftsAttachCmd) Run added in v1.14.0

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

type MailDraftsCmd added in v0.2.0

type MailDraftsCmd struct {
	List   MailDraftsListCmd   `cmd:"" help:"List draft messages"`
	Create MailDraftsCreateCmd `cmd:"" help:"Create a draft message"`
	Send   MailDraftsSendCmd   `cmd:"" help:"Send a draft message"`
	Delete MailDraftsDeleteCmd `cmd:"" help:"Delete a draft message"`
	Attach MailDraftsAttachCmd `cmd:"" help:"Attach a file to an existing draft"`
	Update MailDraftsUpdateCmd `cmd:"" help:"Replace the recipients, subject or body of an existing draft"`
}

MailDraftsCmd groups draft-related subcommands

type MailDraftsCreateCmd added in v0.2.0

type MailDraftsCreateCmd 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:"Body is HTML"`
	Inline  []string `help:"Inline image as CID=PATH (repeatable; HTML only)" placeholder:"CID=PATH"`
}

MailDraftsCreateCmd creates a new draft message

func (*MailDraftsCreateCmd) Run added in v0.2.0

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

type MailDraftsDeleteCmd added in v0.2.0

type MailDraftsDeleteCmd struct {
	ID string `arg:"" help:"Draft message ID"`
}

MailDraftsDeleteCmd deletes a draft message

func (*MailDraftsDeleteCmd) Run added in v0.2.0

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

type MailDraftsListCmd added in v0.2.0

type MailDraftsListCmd struct {
	Top int32 `help:"Number of drafts to return" default:"25" short:"n"`
}

MailDraftsListCmd lists draft messages

func (*MailDraftsListCmd) Run added in v0.2.0

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

type MailDraftsSendCmd added in v0.2.0

type MailDraftsSendCmd struct {
	ID string `arg:"" help:"Draft message ID"`
}

MailDraftsSendCmd sends an existing draft

func (*MailDraftsSendCmd) Run added in v0.2.0

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

type MailDraftsUpdateCmd added in v1.14.0

type MailDraftsUpdateCmd struct {
	ID      string   `arg:"" help:"Draft message ID"`
	To      []string `help:"Replace To recipients; pass an empty string to clear" short:"t"`
	CC      []string `help:"Replace CC recipients; pass an empty string to clear"`
	BCC     []string `help:"Replace BCC recipients; pass an empty string to clear"`
	Subject *string  `help:"Replace the subject" short:"s"`
	Body    *string  `help:"Replace the whole body, including any quoted reply or forward history" short:"b"`
	HTML    bool     `help:"Treat --body as HTML"`
}

MailDraftsUpdateCmd replaces only the recipient lists, subject or body supplied by the caller.

func (*MailDraftsUpdateCmd) Run added in v1.14.0

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

type MailFlagCmd added in v0.2.0

type MailFlagCmd struct {
	ID     string `arg:"" help:"Message ID"`
	Status string `arg:"" help:"Flag status: flagged|complete|notFlagged" enum:"flagged,complete,notFlagged" default:"flagged"`
}

MailFlagCmd sets the follow-up flag on a message

func (*MailFlagCmd) Run added in v0.2.0

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

type MailFoldersCmd

type MailFoldersCmd struct {
	List   MailFoldersListCmd   `cmd:"" default:"1" help:"List all visible mail folders recursively"`
	Create MailFoldersCreateCmd `cmd:"" help:"Create a mail folder"`
	Rename MailFoldersRenameCmd `cmd:"" help:"Rename a mail folder"`
	Delete MailFoldersDeleteCmd `cmd:"" help:"Delete a mail folder"`
}

MailFoldersCmd manages mail folders

type MailFoldersCreateCmd added in v0.4.5

type MailFoldersCreateCmd struct {
	Name string `help:"Folder name" required:"" short:"n"`
}

MailFoldersCreateCmd creates a new mail folder

func (*MailFoldersCreateCmd) Run added in v0.4.5

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

type MailFoldersDeleteCmd added in v0.4.5

type MailFoldersDeleteCmd struct {
	ID string `arg:"" help:"Folder ID"`
}

MailFoldersDeleteCmd deletes a mail folder

func (*MailFoldersDeleteCmd) Run added in v0.4.5

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

type MailFoldersListCmd added in v0.4.5

type MailFoldersListCmd struct {
	WellKnown string `help:"Resolve one guarded destination by canonical Graph name (archive, deleteditems, inbox, or junkemail)"`
}

MailFoldersListCmd lists all visible mail folders recursively (default subcommand)

func (*MailFoldersListCmd) Run added in v0.4.5

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

type MailFoldersRenameCmd added in v0.4.5

type MailFoldersRenameCmd struct {
	ID   string `arg:"" help:"Folder ID"`
	Name string `help:"New folder name" required:"" short:"n"`
}

MailFoldersRenameCmd renames a mail folder

func (*MailFoldersRenameCmd) Run added in v0.4.5

func (c *MailFoldersRenameCmd) 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"`
	CC      []string `help:"CC recipients"`
	Comment string   `help:"Comment to include" short:"c"`
	HTML    bool     `help:"Comment is HTML"`
	Draft   bool     `help:"Create a forward draft instead of sending"`
}

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|eml (eml is the raw RFC 5322 message)" default:"full" enum:"full,text,html,eml"`
	Out    string `help:"With --format eml, write the message to this file instead of stdout" type:"path"`
}

func (*MailGetCmd) Run

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

type MailImportanceCmd added in v0.2.0

type MailImportanceCmd struct {
	ID         string `arg:"" help:"Message ID"`
	Importance string `arg:"" help:"Importance: low|normal|high" enum:"low,normal,high"`
}

MailImportanceCmd sets the importance level on a message

func (*MailImportanceCmd) Run added in v0.2.0

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

type MailListCmd

type MailListCmd struct {
	Folder  string  `help:"Mail folder ID, well-known name, or path (for example Inbox/2026)" short:"f" env:"OLK_MAIL_FOLDER" default:"inbox"`
	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)"`
	Focused bool    `help:"Show only Focused Inbox messages"`
	Other   bool    `help:"Show only Other Inbox messages"`
	Order   *string `help:"Message order: newest|oldest (default newest)" enum:"newest,oldest"`
}

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, well-known name, or path (for example Inbox/2026)"`
}

func (*MailMoveCmd) Run

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

type MailOOOCmd added in v0.2.0

type MailOOOCmd struct {
	Get MailOOOGetCmd `cmd:"" help:"Get auto-reply settings"`
	Set MailOOOSetCmd `cmd:"" help:"Set auto-reply"`
	Off MailOOOOffCmd `cmd:"" help:"Disable auto-reply"`
}

MailOOOCmd is the parent command for out-of-office / auto-reply settings

type MailOOOGetCmd added in v0.2.0

type MailOOOGetCmd struct{}

MailOOOGetCmd retrieves the current auto-reply settings

func (*MailOOOGetCmd) Run added in v0.2.0

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

type MailOOOOffCmd added in v0.2.0

type MailOOOOffCmd struct{}

MailOOOOffCmd disables auto-reply

func (*MailOOOOffCmd) Run added in v0.2.0

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

type MailOOOSetCmd added in v0.2.0

type MailOOOSetCmd struct {
	Message         string `help:"Auto-reply message (internal)" required:"" short:"m"`
	ExternalMessage string `help:"Auto-reply message for external senders (defaults to --message)" short:"x"`
	Start           string `help:"Start date/time (ISO 8601, enables scheduled mode)"`
	End             string `help:"End date/time (ISO 8601, enables scheduled mode)"`
	Audience        string `help:"External audience: none|contactsOnly|all" default:"all" enum:"none,contactsOnly,all"`
}

MailOOOSetCmd enables auto-reply with the given message

func (*MailOOOSetCmd) Run added in v0.2.0

func (c *MailOOOSetCmd) 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"`
	HTML     bool     `help:"Reply body is HTML"`
	ReplyAll bool     `help:"Reply to all recipients" short:"a"`
	Draft    bool     `help:"Create a reply draft instead of sending"`
	Inline   []string `help:"Inline image as CID=PATH (repeatable; HTML drafts only)" placeholder:"CID=PATH"`
}

func (*MailReplyCmd) Run

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

type MailRulesCmd added in v0.3.0

type MailRulesCmd struct {
	List   MailRulesListCmd   `cmd:"" help:"List inbox rules"`
	Create MailRulesCreateCmd `cmd:"" help:"Create an inbox rule"`
	Delete MailRulesDeleteCmd `cmd:"" help:"Delete an inbox rule"`
}

type MailRulesCreateCmd added in v0.3.0

type MailRulesCreateCmd struct {
	Name           string `help:"Rule name" required:"" short:"n"`
	From           string `help:"Match sender email"`
	SubjectContain string `help:"Match subject containing text" name:"subject-contains"`
	HasAttachment  bool   `help:"Match messages with attachments"`
	Move           string `help:"Move to folder ID or well-known name"`
	MarkRead       bool   `help:"Mark as read"`
	Delete         bool   `help:"Delete the message"`
	ForwardTo      string `help:"Forward to email address" name:"forward-to"`
	SetImportance  string `help:"Set importance: low|normal|high" name:"set-importance" enum:",low,normal,high" default:""`
}

func (*MailRulesCreateCmd) Run added in v0.3.0

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

type MailRulesDeleteCmd added in v0.3.0

type MailRulesDeleteCmd struct {
	ID string `arg:"" help:"Rule ID"`
}

func (*MailRulesDeleteCmd) Run added in v0.3.0

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

type MailRulesListCmd added in v0.3.0

type MailRulesListCmd struct{}

func (*MailRulesListCmd) Run added in v0.3.0

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

type MailSearchCmd

type MailSearchCmd struct {
	Query string `arg:"" help:"Search query — supports KQL operators (from:, subject:, hasAttachment:, etc.)"`
	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"`
	Attach      []string `help:"File paths to attach" type:"path"`
	Importance  string   `help:"Message importance: low|normal|high" enum:",low,normal,high" default:""`
	ReadReceipt bool     `help:"Request a read receipt"`
}

func (*MailSendCmd) Run

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

type MailThreadCmd added in v1.9.6

type MailThreadCmd struct {
	ConversationID string  `arg:"" help:"Conversation ID (a message's conversationId)" name:"conversation-id"`
	Top            int32   `help:"Max messages to return" default:"50" short:"n"`
	Complete       bool    `help:"Consume every provider page before returning"`
	BodyFormat     *string `help:"Request provider-returned message body representation" enum:"text,html"`
}

MailThreadCmd returns every message in a conversation, oldest first. The conversation id comes from a message's conversationId field (shown by mail list and mail get).

func (*MailThreadCmd) Run added in v1.9.6

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

type PeopleCmd added in v0.3.0

type PeopleCmd struct {
	Search PeopleSearchCmd `cmd:"" help:"Search people directory"`
}

type PeopleSearchCmd added in v0.3.0

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

func (*PeopleSearchCmd) Run added in v0.3.0

func (c *PeopleSearchCmd) 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"`
	Mailbox      string       `` /* 226-byte string literal not displayed */
	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       SelectFields `help:"Comma-separated fields to output" env:"OLK_SELECT"`
	ResultsOnly  bool         `help:"Output only the results array (no envelope)" env:"OLK_RESULTS_ONLY"`
	Concise      bool         `` /* 138-byte string literal not displayed */
	Timeout      int          `help:"Request timeout in seconds" default:"60" env:"OLK_TIMEOUT"`
	TimeZone     string       `help:"IANA time zone for display (e.g. America/New_York, Local, UTC)" name:"tz" env:"OLK_TIMEZONE"`
	ImmutableIDs bool         `help:"Use Outlook IDs that remain stable across moves within one mailbox" name:"immutable-ids" env:"OLK_IMMUTABLE_IDS"`

	// Capability guards (enforced for CLI, MCP, scripts, and --mailbox alike).
	// Named --no-write rather than --read-only because `auth login --read-only`
	// already exists (it requests read-only OAuth scopes).
	NoWrite       bool `help:"Refuse any mutating operation" env:"OLK_NO_WRITE"`
	NoSend        bool `help:"Refuse sending mail or meeting invites" env:"OLK_NO_SEND"`
	NoInput       bool `help:"Fail instead of prompting (headless/agent safety)" env:"OLK_NO_INPUT"`
	WrapUntrusted bool `help:"Wrap external free-text in untrusted-content markers (JSON/plain output)" env:"OLK_WRAP_UNTRUSTED"`

	// Command-scoping allow/deny lists (comma-separated dotted paths).
	EnableCommands      string `help:"Allow only these command prefixes (csv; e.g. mail,calendar)" env:"OLK_ENABLE_COMMANDS"`
	EnableCommandsExact string `help:"Allow only these exact command paths (csv; e.g. mail.list,mail.get)" env:"OLK_ENABLE_COMMANDS_EXACT"`
	DisableCommands     string `help:"Block these command paths (csv; overrides allows)" env:"OLK_DISABLE_COMMANDS"`
}

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

func (*RunContext) Timezone added in v0.6.0

func (r *RunContext) Timezone() (*time.Location, error)

Timezone returns the resolved time.Location for display. Precedence: --tz flag > OLK_TIMEZONE env > config file > Local.

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 SelectFields added in v1.11.0

type SelectFields struct {
	Value string
	Set   bool
}

SelectFields records whether --select was supplied so an explicit empty value can be rejected instead of being confused with an absent selection.

func (*SelectFields) UnmarshalText added in v1.11.0

func (s *SelectFields) UnmarshalText(value []byte) 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"`
	Attach      []string `help:"File paths to attach" type:"path"`
	Importance  string   `help:"Message importance: low|normal|high" enum:",low,normal,high" default:""`
	ReadReceipt bool     `help:"Request a read receipt"`
}

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 TodoAttachCmd added in v0.6.0

type TodoAttachCmd struct {
	List     TodoAttachListCmd     `cmd:"" help:"List task attachments"`
	Upload   TodoAttachUploadCmd   `cmd:"" help:"Upload a file attachment"`
	Download TodoAttachDownloadCmd `cmd:"" help:"Download an attachment"`
	Delete   TodoAttachDeleteCmd   `cmd:"" help:"Delete an attachment"`
}

TodoAttachCmd manages file attachments on tasks.

type TodoAttachDeleteCmd added in v0.6.0

type TodoAttachDeleteCmd struct {
	TaskID       string `arg:"" help:"Task ID"`
	AttachmentID string `arg:"" help:"Attachment ID"`
	List         string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoAttachDeleteCmd deletes an attachment from a task.

func (*TodoAttachDeleteCmd) Run added in v0.6.0

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

type TodoAttachDownloadCmd added in v0.6.0

type TodoAttachDownloadCmd struct {
	TaskID       string `arg:"" help:"Task ID"`
	AttachmentID string `arg:"" help:"Attachment ID"`
	Out          string `help:"Output directory for download" default:"." type:"path"`
	List         string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoAttachDownloadCmd downloads an attachment from a task.

func (*TodoAttachDownloadCmd) Run added in v0.6.0

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

type TodoAttachListCmd added in v0.6.0

type TodoAttachListCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoAttachListCmd lists attachments on a task.

func (*TodoAttachListCmd) Run added in v0.6.0

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

type TodoAttachUploadCmd added in v0.6.0

type TodoAttachUploadCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	File   string `arg:"" help:"File to upload" type:"existingfile"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoAttachUploadCmd uploads a file attachment to a task.

func (*TodoAttachUploadCmd) Run added in v0.6.0

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

type TodoChecklistCmd added in v0.6.0

type TodoChecklistCmd struct {
	List   TodoChecklistListCmd   `cmd:"" help:"List checklist items"`
	Create TodoChecklistCreateCmd `cmd:"" help:"Create a checklist item"`
	Toggle TodoChecklistToggleCmd `cmd:"" help:"Toggle a checklist item checked/unchecked"`
	Update TodoChecklistUpdateCmd `cmd:"" help:"Update a checklist item"`
	Delete TodoChecklistDeleteCmd `cmd:"" help:"Delete a checklist item"`
}

TodoChecklistCmd manages checklist items within a task.

type TodoChecklistCreateCmd added in v0.6.0

type TodoChecklistCreateCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	Name   string `help:"Checklist item name" required:"" short:"n"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoChecklistCreateCmd creates a new checklist item.

func (*TodoChecklistCreateCmd) Run added in v0.6.0

type TodoChecklistDeleteCmd added in v0.6.0

type TodoChecklistDeleteCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	ItemID string `arg:"" help:"Checklist item ID"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoChecklistDeleteCmd deletes a checklist item.

func (*TodoChecklistDeleteCmd) Run added in v0.6.0

type TodoChecklistListCmd added in v0.6.0

type TodoChecklistListCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoChecklistListCmd lists checklist items in a task.

func (*TodoChecklistListCmd) Run added in v0.6.0

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

type TodoChecklistToggleCmd added in v0.6.0

type TodoChecklistToggleCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	ItemID string `arg:"" help:"Checklist item ID"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoChecklistToggleCmd toggles a checklist item checked/unchecked.

func (*TodoChecklistToggleCmd) Run added in v0.6.0

type TodoChecklistUpdateCmd added in v0.6.0

type TodoChecklistUpdateCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	ItemID string `arg:"" help:"Checklist item ID"`
	Name   string `help:"New name" short:"n"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoChecklistUpdateCmd updates a checklist item.

func (*TodoChecklistUpdateCmd) Run added in v0.6.0

type TodoCmd added in v0.2.0

type TodoCmd struct {
	Lists     TodoListsCmd     `cmd:"" help:"Task list operations"`
	List      TodoListCmd      `cmd:"" help:"List tasks in a list"`
	Get       TodoGetCmd       `cmd:"" help:"Get task details"`
	Create    TodoCreateCmd    `cmd:"" help:"Create a task"`
	Complete  TodoCompleteCmd  `cmd:"" help:"Mark a task as complete"`
	Update    TodoUpdateCmd    `cmd:"" help:"Update a task"`
	Delete    TodoDeleteCmd    `cmd:"" help:"Delete a task"`
	Checklist TodoChecklistCmd `cmd:"" help:"Checklist item operations"`
	Attach    TodoAttachCmd    `cmd:"" help:"Task attachment operations"`
	Links     TodoLinksCmd     `cmd:"" help:"Linked resource operations"`
}

TodoCmd is the top-level command group for Microsoft To Do tasks.

type TodoCompleteCmd added in v0.2.0

type TodoCompleteCmd struct {
	ID   string `arg:"" help:"Task ID"`
	List string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoCompleteCmd marks a task as complete.

func (*TodoCompleteCmd) Run added in v0.2.0

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

type TodoCreateCmd added in v0.2.0

type TodoCreateCmd struct {
	List       string   `help:"Task list ID" env:"OLK_TODO_LIST"`
	Title      string   `help:"Task title" required:"" short:"t"`
	Due        string   `help:"Due date (ISO 8601, e.g. 2024-12-31)" short:"d"`
	Start      string   `help:"Start date (ISO 8601)" short:"s"`
	Reminder   string   `help:"Reminder date/time (ISO 8601)"`
	Recurrence string   `help:"Recurrence pattern" enum:"daily,weekdays,weekly,monthly,yearly," default:""`
	Importance string   `help:"Importance level" enum:"low,normal,high," default:""`
	Body       string   `help:"Task body text" short:"b"`
	Categories []string `help:"Categories to assign" short:"c"`
}

TodoCreateCmd creates a new task.

func (*TodoCreateCmd) Run added in v0.2.0

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

type TodoDeleteCmd added in v0.2.0

type TodoDeleteCmd struct {
	ID   string `arg:"" help:"Task ID"`
	List string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoDeleteCmd deletes a task.

func (*TodoDeleteCmd) Run added in v0.2.0

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

type TodoGetCmd added in v0.2.0

type TodoGetCmd struct {
	ID   string `arg:"" help:"Task ID"`
	List string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoGetCmd gets details of a single task.

func (*TodoGetCmd) Run added in v0.2.0

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

type TodoLinksCmd added in v0.6.0

type TodoLinksCmd struct {
	List   TodoLinksListCmd   `cmd:"" help:"List linked resources"`
	Create TodoLinksCreateCmd `cmd:"" help:"Create a linked resource"`
	Delete TodoLinksDeleteCmd `cmd:"" help:"Delete a linked resource"`
}

TodoLinksCmd manages linked resources on tasks.

type TodoLinksCreateCmd added in v0.6.0

type TodoLinksCreateCmd struct {
	TaskID     string `arg:"" help:"Task ID"`
	Name       string `help:"Display name" required:"" short:"n"`
	URL        string `help:"Web URL"`
	AppName    string `help:"Application name" default:"olk"`
	ExternalID string `help:"External ID"`
	List       string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoLinksCreateCmd creates a linked resource on a task.

func (*TodoLinksCreateCmd) Run added in v0.6.0

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

type TodoLinksDeleteCmd added in v0.6.0

type TodoLinksDeleteCmd struct {
	TaskID     string `arg:"" help:"Task ID"`
	ResourceID string `arg:"" help:"Linked resource ID"`
	List       string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoLinksDeleteCmd deletes a linked resource from a task.

func (*TodoLinksDeleteCmd) Run added in v0.6.0

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

type TodoLinksListCmd added in v0.6.0

type TodoLinksListCmd struct {
	TaskID string `arg:"" help:"Task ID"`
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
}

TodoLinksListCmd lists linked resources for a task.

func (*TodoLinksListCmd) Run added in v0.6.0

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

type TodoListCmd added in v0.2.0

type TodoListCmd struct {
	List   string `help:"Task list ID" env:"OLK_TODO_LIST"`
	Top    int32  `help:"Number of tasks to return" default:"25" short:"n"`
	Status string `help:"Filter by status" enum:"notStarted,inProgress,completed,waitingOnOthers,deferred," default:""`
}

TodoListCmd lists tasks in a task list.

func (*TodoListCmd) Run added in v0.2.0

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

type TodoListsCmd added in v0.2.0

type TodoListsCmd struct {
	List   TodoListsListCmd   `cmd:"" default:"1" help:"List task lists"`
	Create TodoListsCreateCmd `cmd:"" help:"Create a task list"`
	Delete TodoListsDeleteCmd `cmd:"" help:"Delete a task list"`
}

TodoListsCmd manages task lists.

type TodoListsCreateCmd added in v0.4.5

type TodoListsCreateCmd struct {
	Name string `help:"List name" required:"" short:"n"`
}

TodoListsCreateCmd creates a new task list.

func (*TodoListsCreateCmd) Run added in v0.4.5

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

type TodoListsDeleteCmd added in v0.4.5

type TodoListsDeleteCmd struct {
	ID string `arg:"" help:"Task list ID"`
}

TodoListsDeleteCmd deletes a task list.

func (*TodoListsDeleteCmd) Run added in v0.4.5

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

type TodoListsListCmd added in v0.4.5

type TodoListsListCmd struct{}

TodoListsListCmd lists all task lists (default subcommand).

func (*TodoListsListCmd) Run added in v0.4.5

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

type TodoUpdateCmd added in v0.4.5

type TodoUpdateCmd struct {
	ID         string   `arg:"" help:"Task ID"`
	List       string   `help:"Task list ID" env:"OLK_TODO_LIST"`
	Title      string   `help:"New title" short:"t"`
	Due        string   `help:"New due date (ISO 8601, or 'none' to clear)" short:"d"`
	Start      string   `help:"New start date (ISO 8601, or 'none' to clear)" short:"s"`
	Reminder   string   `help:"New reminder date/time (ISO 8601, or 'none' to clear)"`
	Recurrence string   `help:"New recurrence pattern, or 'none' to clear" enum:"daily,weekdays,weekly,monthly,yearly,none," default:""`
	Importance string   `help:"New importance level" enum:"low,normal,high," default:""`
	Body       string   `help:"New body text" short:"b"`
	Categories []string `help:"New categories (use -c none to clear)" short:"c"`
}

TodoUpdateCmd updates a task's properties.

func (*TodoUpdateCmd) Run added in v0.4.5

func (c *TodoUpdateCmd) 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

type WhoamiCmd added in v0.2.0

type WhoamiCmd struct{}

WhoamiCmd displays the current user's profile information

func (*WhoamiCmd) Run added in v0.2.0

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

Jump to

Keyboard shortcuts

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