cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentsCmd

type AgentsCmd struct{}

AgentsCmd is `chatwoot agents` — list agents on the account.

func (*AgentsCmd) Run

func (c *AgentsCmd) Run(app *App) error

type App

type App struct {
	Client  *sdk.Client
	Printer *output.Printer
	Config  *config.Config
	Version string
}

App holds shared state passed to every command's Run method.

func NewApp

func NewApp(cli *CLI, skipAuth bool, version string) (*App, error)

NewApp creates an App from the parsed CLI flags. Commands that don't need auth (auth login/logout, config) pass skipAuth=true.

type AuthCmd

type AuthCmd struct {
	Login  AuthLoginCmd  `cmd:"" help:"Login with your Chatwoot credentials."`
	Logout AuthLogoutCmd `cmd:"" help:"Logout and remove saved credentials."`
	Status AuthStatusCmd `cmd:"" help:"Show current authentication status."`
}

type AuthLoginCmd

type AuthLoginCmd struct{}

func (*AuthLoginCmd) Run

func (c *AuthLoginCmd) Run(app *App) error

type AuthLogoutCmd

type AuthLogoutCmd struct{}

func (*AuthLogoutCmd) Run

func (c *AuthLogoutCmd) Run(app *App) error

type AuthStatusCmd

type AuthStatusCmd struct{}

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run(app *App) error

type CLI

type CLI struct {
	Output  string `short:"o" default:"text" enum:"text,json,csv" help:"Output format."`
	Account int    `short:"a" help:"Override account ID."`
	Quiet   bool   `short:"q" help:"Print only IDs."`
	NoColor bool   `help:"Disable colored output."`
	Verbose bool   `short:"v" help:"Show request/response details."`

	// Plurals — list commands.
	Convs    ConvsCmd    `cmd:"" aliases:"conversations" help:"List conversations."`
	Contacts ContactsCmd `cmd:"" help:"List or search contacts."`
	Inboxes  InboxesCmd  `cmd:"" help:"List inboxes."`
	Agents   AgentsCmd   `cmd:"" help:"List agents."`
	Labels   LabelsCmd   `cmd:"" help:"List labels."`
	Teams    TeamsCmd    `cmd:"" help:"List teams."`

	// Singulars — context for verbs and subresources.
	Conv    ConvCmd    `cmd:"" aliases:"conversation" help:"View or act on a conversation."`
	Contact ContactCmd `cmd:"" help:"View a contact."`
	Inbox   InboxCmd   `cmd:"" help:"View an inbox."`

	// Workflow. `me` and `whoami` are aliases of `auth status`.
	Me     MeCmd     `cmd:"" help:"Show identity and connection (alias of 'auth status')."`
	Whoami WhoamiCmd `cmd:"" help:"Show identity and connection (alias of 'auth status')."`

	// Setup.
	Auth   AuthCmd   `cmd:"" help:"Login, logout, and status."`
	Config ConfigCmd `cmd:"" aliases:"cfg" help:"Manage CLI configuration."`

	Completion kongcompletion.Completion `cmd:"" help:"Print shell completion setup."`
	Version    VersionCmd                `cmd:"" help:"Print the CLI version."`

	VersionFlag kong.VersionFlag `name:"version" help:"Print the CLI version."`
}

CLI is the root Kong struct defining the entire command tree.

Grammar:

  • Plural noun = list: `chatwoot convs`, `chatwoot contacts`
  • Singular + verb + id: `chatwoot conv view 123`, `chatwoot conv reply 123 "hi"`
  • `conv 123` is shorthand for `conv view 123` (default subcommand).

type ConfigCmd

type ConfigCmd struct {
	Path ConfigPathCmd `cmd:"" help:"Print the config file path."`
	View ConfigViewCmd `cmd:"" help:"Print current configuration."`
}

type ConfigPathCmd

type ConfigPathCmd struct{}

func (*ConfigPathCmd) Run

func (c *ConfigPathCmd) Run(app *App) error

type ConfigViewCmd

type ConfigViewCmd struct{}

func (*ConfigViewCmd) Run

func (c *ConfigViewCmd) Run(app *App) error

type ContactCmd

type ContactCmd struct {
	View          ContactViewCmd          `cmd:"" default:"withargs" help:"View a contact (default)."`
	Conversations ContactConversationsCmd `cmd:"" help:"List conversations for the contact."`
}

type ContactConversationsCmd

type ContactConversationsCmd struct {
	ID int `arg:"" help:"Contact ID."`
}

func (*ContactConversationsCmd) Run

func (c *ContactConversationsCmd) Run(app *App) error

type ContactViewCmd

type ContactViewCmd struct {
	ID int `arg:"" help:"Contact ID."`
}

func (*ContactViewCmd) Run

func (c *ContactViewCmd) Run(app *App) error

type ContactsCmd

type ContactsCmd struct {
	Search string `help:"Search query (name, email, phone)."`
	Page   int    `short:"p" default:"1" help:"Page number."`
	Sort   string `help:"Sort by name, email, phone_number, last_activity_at; '-' prefix for descending."`
}

func (*ContactsCmd) Run

func (c *ContactsCmd) Run(app *App) error

type ConvAssignCmd

type ConvAssignCmd struct {
	ID    int    `arg:"" help:"Conversation ID."`
	Agent string `help:"Agent ID, 'me', or name (case-insensitive substring)."`
	Team  int    `help:"Team ID."`
}

func (*ConvAssignCmd) Run

func (c *ConvAssignCmd) Run(app *App) error

type ConvCmd

type ConvCmd struct {
	View     ConvViewCmd     `cmd:"" default:"withargs" help:"View a conversation (default)."`
	Messages ConvMessagesCmd `cmd:"" help:"List messages in the conversation."`
	Reply    ConvReplyCmd    `cmd:"" help:"Reply to the conversation."`
	Resolve  ConvResolveCmd  `cmd:"" help:"Mark the conversation as resolved."`
	Open     ConvOpenCmd     `cmd:"" help:"Set the conversation status to open."`
	Pending  ConvPendingCmd  `cmd:"" help:"Set the conversation status to pending."`
	Snooze   ConvSnoozeCmd   `cmd:"" help:"Snooze the conversation (default: until next reply)."`
	Assign   ConvAssignCmd   `cmd:"" help:"Assign the conversation to an agent and/or team (--agent, --team)."`
	Unassign ConvUnassignCmd `cmd:"" help:"Remove the assignee."`
	Label    ConvLabelCmd    `cmd:"" help:"Set labels on the conversation (replaces existing)."`
	Priority ConvPriorityCmd `cmd:"" help:"Set or clear conversation priority."`
}

type ConvLabelCmd

type ConvLabelCmd struct {
	ID     int      `arg:"" help:"Conversation ID."`
	Labels []string `arg:"" help:"Labels to set (comma-separated or repeated). Replaces existing."`
}

func (*ConvLabelCmd) Run

func (c *ConvLabelCmd) Run(app *App) error

type ConvMessagesCmd

type ConvMessagesCmd struct {
	ID     int `arg:"" help:"Conversation ID."`
	Before int `help:"Messages before this message ID."`
	After  int `help:"Messages after this message ID."`
}

func (*ConvMessagesCmd) Run

func (c *ConvMessagesCmd) Run(app *App) error

type ConvOpenCmd

type ConvOpenCmd struct {
	ID int `arg:"" help:"Conversation ID."`
}

func (*ConvOpenCmd) Run

func (c *ConvOpenCmd) Run(app *App) error

type ConvPendingCmd

type ConvPendingCmd struct {
	ID int `arg:"" help:"Conversation ID."`
}

func (*ConvPendingCmd) Run

func (c *ConvPendingCmd) Run(app *App) error

type ConvPriorityCmd

type ConvPriorityCmd struct {
	ID    int    `arg:"" help:"Conversation ID."`
	Level string `arg:"" enum:"urgent,high,medium,low,none" help:"Priority: urgent, high, medium, low, or none."`
}

func (*ConvPriorityCmd) Run

func (c *ConvPriorityCmd) Run(app *App) error

type ConvReplyCmd

type ConvReplyCmd struct {
	ID      int    `arg:"" help:"Conversation ID."`
	Text    string `arg:"" help:"Reply content."`
	Private bool   `help:"Send as a private note instead of a public reply."`
}

func (*ConvReplyCmd) Run

func (c *ConvReplyCmd) Run(app *App) error

type ConvResolveCmd

type ConvResolveCmd struct {
	ID int `arg:"" help:"Conversation ID."`
}

func (*ConvResolveCmd) Run

func (c *ConvResolveCmd) Run(app *App) error

type ConvSnoozeCmd

type ConvSnoozeCmd struct {
	ID    int    `arg:"" help:"Conversation ID."`
	Until string `help:"Snooze duration (e.g. 24h, 7d) or absolute date (2006-01-02). Omit to snooze until next reply."`
}

func (*ConvSnoozeCmd) Run

func (c *ConvSnoozeCmd) Run(app *App) error

type ConvUnassignCmd

type ConvUnassignCmd struct {
	ID int `arg:"" help:"Conversation ID."`
}

func (*ConvUnassignCmd) Run

func (c *ConvUnassignCmd) Run(app *App) error

type ConvViewCmd

type ConvViewCmd struct {
	ID int `arg:"" help:"Conversation ID."`
}

func (*ConvViewCmd) Run

func (c *ConvViewCmd) Run(app *App) error

type ConvsCmd

type ConvsCmd struct {
	Status   string   `short:"s" default:"open" help:"Filter: open, resolved, pending, snoozed."`
	Inbox    int      `short:"i" help:"Filter by inbox ID."`
	Assignee string   `default:"me" help:"Filter: me, unassigned, all."`
	Team     int      `help:"Filter by team ID."`
	Label    []string `short:"l" help:"Filter by labels."`
	Query    string   `help:"Search conversations by message content."`
	Page     int      `short:"p" default:"1" help:"Page number."`
}

func (*ConvsCmd) Run

func (c *ConvsCmd) Run(app *App) error

type InboxCmd

type InboxCmd struct {
	View InboxViewCmd `cmd:"" default:"withargs" help:"View an inbox (default)."`
}

type InboxViewCmd

type InboxViewCmd struct {
	ID int `arg:"" help:"Inbox ID."`
}

func (*InboxViewCmd) Run

func (c *InboxViewCmd) Run(app *App) error

type InboxesCmd

type InboxesCmd struct{}

func (*InboxesCmd) Run

func (c *InboxesCmd) Run(app *App) error

type LabelsCmd

type LabelsCmd struct{}

LabelsCmd is `chatwoot labels` — list labels defined on the account.

func (*LabelsCmd) Run

func (c *LabelsCmd) Run(app *App) error

type MeCmd

type MeCmd struct{}

MeCmd is `chatwoot me` — alias of `chatwoot auth status`.

func (*MeCmd) Run

func (c *MeCmd) Run(app *App) error

type TeamsCmd

type TeamsCmd struct{}

TeamsCmd is `chatwoot teams` — list teams on the account.

func (*TeamsCmd) Run

func (c *TeamsCmd) Run(app *App) error

type VersionCmd added in v0.2.0

type VersionCmd struct{}

VersionCmd is `chatwoot version` — prints the CLI version. Equivalent to the `--version` flag, exposed as a subcommand for discoverability.

func (*VersionCmd) Run added in v0.2.0

func (c *VersionCmd) Run(app *App) error

type WhoamiCmd added in v0.2.0

type WhoamiCmd struct{}

WhoamiCmd is `chatwoot whoami` — alias of `chatwoot auth status`.

func (*WhoamiCmd) Run added in v0.2.0

func (c *WhoamiCmd) Run(app *App) error

Jump to

Keyboard shortcuts

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