cmd

package
v0.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CodeSuccess   = 0
	CodeError     = 1
	CodeUsage     = 2
	CodeAuth      = 3
	CodeAPI       = 4
	CodeRateLimit = 5
)

Exit code constants.

Variables

This section is empty.

Functions

func Execute

func Execute(args []string) (err error)

Execute runs the CLI with the given arguments.

func ExitCode

func ExitCode(err error) int

func VersionString

func VersionString() string

Types

type AuthCmd

type AuthCmd struct {
	SetKey AuthSetKeyCmd `cmd:"" name:"set-key" help:"Store API key in keyring"`
	Status AuthStatusCmd `cmd:"" help:"Show API key status"`
	Remove AuthRemoveCmd `cmd:"" help:"Remove stored API key"`
}

AuthCmd manages API key storage.

type AuthRemoveCmd

type AuthRemoveCmd struct{}

AuthRemoveCmd removes the stored API key.

func (*AuthRemoveCmd) Run

func (c *AuthRemoveCmd) Run() error

Run deletes the API key from keyring.

type AuthSetKeyCmd

type AuthSetKeyCmd struct {
	Stdin bool `help:"Read API key from stdin (for scripts)"`
}

AuthSetKeyCmd stores an API key in the system keyring.

func (*AuthSetKeyCmd) Run

func (c *AuthSetKeyCmd) Run() error

Run prompts for an API key and stores it.

type AuthStatusCmd

type AuthStatusCmd struct{}

AuthStatusCmd shows the current API key status.

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run() error

Run checks env var, keyring, and reports status.

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Show version information"`
	Auth       AuthCmd          `cmd:"" help:"Manage API key"`
	Config     ConfigCmd        `cmd:"" help:"Manage configuration"`
	Poll       PollCmd          `cmd:"" help:"Poll commands"`
	Meeting    MeetingCmd       `cmd:"" help:"Meeting poll commands"`
	Ranking    RankingCmd       `cmd:"" help:"Ranking poll commands"`
	Completion CompletionCmd    `cmd:"" help:"Generate shell completions"`
}

CLI is the top-level Kong CLI struct.

type CompletionBashCmd

type CompletionBashCmd struct{}

CompletionBashCmd generates bash completion script.

func (*CompletionBashCmd) Run

func (c *CompletionBashCmd) Run() error

Run prints the bash completion script.

type CompletionCmd

type CompletionCmd struct {
	Bash CompletionBashCmd `cmd:"" help:"Generate bash completions"`
	Zsh  CompletionZshCmd  `cmd:"" help:"Generate zsh completions"`
	Fish CompletionFishCmd `cmd:"" help:"Generate fish completions"`
}

CompletionCmd generates shell completion scripts.

type CompletionFishCmd

type CompletionFishCmd struct{}

CompletionFishCmd generates fish completion script.

func (*CompletionFishCmd) Run

func (c *CompletionFishCmd) Run() error

Run prints the fish completion script.

type CompletionZshCmd

type CompletionZshCmd struct{}

CompletionZshCmd generates zsh completion script.

func (*CompletionZshCmd) Run

func (c *CompletionZshCmd) Run() error

Run prints the zsh completion script.

type ConfigCmd

type ConfigCmd struct {
	Show ConfigShowCmd `cmd:"" help:"Display current configuration"`
	Set  ConfigSetCmd  `cmd:"" help:"Set a configuration value"`
	Path ConfigPathCmd `cmd:"" help:"Show configuration file path"`
}

ConfigCmd manages CLI configuration.

type ConfigPathCmd

type ConfigPathCmd struct{}

ConfigPathCmd shows the config file path.

func (*ConfigPathCmd) Run

func (c *ConfigPathCmd) Run() error

Run prints the config file path.

type ConfigSetCmd

type ConfigSetCmd struct {
	Key   string `arg:"" required:"" help:"Configuration key"`
	Value string `arg:"" required:"" help:"Configuration value"`
}

ConfigSetCmd sets a configuration value.

func (*ConfigSetCmd) Run

func (c *ConfigSetCmd) Run() error

Run sets a config key to the given value.

type ConfigShowCmd

type ConfigShowCmd struct{}

ConfigShowCmd displays the current configuration.

func (*ConfigShowCmd) Run

func (c *ConfigShowCmd) Run(flags *RootFlags) error

Run reads and prints the config file.

type ExitError

type ExitError struct {
	Code int
	Err  error
}

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) Unwrap

func (e *ExitError) Unwrap() error

type MeetingCmd

type MeetingCmd struct {
	Create  MeetingCreateCmd  `cmd:"" help:"Create a meeting poll"`
	Get     MeetingGetCmd     `cmd:"" help:"Get meeting poll details"`
	Results MeetingResultsCmd `cmd:"" help:"View meeting availability"`
	Delete  MeetingDeleteCmd  `cmd:"" help:"Delete a meeting poll"`
	Update  MeetingUpdateCmd  `cmd:"" help:"Update a meeting poll"`
	List    MeetingListCmd    `cmd:"" help:"List meeting polls"`
}

MeetingCmd groups meeting poll subcommands.

type MeetingCreateCmd

type MeetingCreateCmd struct {
	Title string `arg:"" required:"" help:"Meeting poll title"`

	// Date/Time options
	Date  []string `help:"All-day date in YYYY-MM-DD format (repeatable)" short:"d"`
	Range []string `help:"Time range as 'YYYY-MM-DD HH:MM-HH:MM' (repeatable)" short:"r"`
	Tz    string   `help:"IANA timezone (e.g. Europe/Berlin); defaults to local" default:""`

	// Meeting details
	Location    string `help:"Meeting location" default:""`
	Description string `help:"Poll description" default:""`

	// Meeting-specific options
	AllowMaybe bool   `help:"Allow 'if need be' responses" default:"true" negatable:""`
	Dupcheck   string `help:"Duplication checking: ip, session, none" default:"none"`
	Deadline   string `help:"Deadline (RFC3339 or duration like 24h)" default:""`
}

MeetingCreateCmd creates a meeting poll with date/time options.

func (*MeetingCreateCmd) Run

func (c *MeetingCreateCmd) Run(flags *RootFlags) error

Run creates a meeting poll via the API.

type MeetingDeleteCmd

type MeetingDeleteCmd struct {
	ID    string `arg:"" required:"" help:"Meeting poll ID or URL"`
	Force bool   `help:"Skip confirmation prompt" short:"f"`
}

MeetingDeleteCmd deletes a meeting poll.

func (*MeetingDeleteCmd) Run

func (c *MeetingDeleteCmd) Run(_ *RootFlags) error

Run deletes a meeting poll, prompting for confirmation unless --force.

type MeetingGetCmd

type MeetingGetCmd struct {
	ID string `arg:"" required:"" help:"Meeting poll ID or URL"`
}

MeetingGetCmd retrieves meeting poll details.

func (*MeetingGetCmd) Run

func (c *MeetingGetCmd) Run(flags *RootFlags) error

Run fetches and displays a meeting poll with formatted timeslots.

type MeetingListCmd

type MeetingListCmd struct {
	Limit int `help:"Results per page" default:"20"`
	Page  int `help:"Page number" default:"1"`
}

MeetingListCmd lists the user's meeting polls.

func (*MeetingListCmd) Run

func (c *MeetingListCmd) Run(flags *RootFlags) error

Run lists meeting polls with client-side type filtering and pagination.

type MeetingResultsCmd

type MeetingResultsCmd struct {
	ID            string `arg:"" required:"" help:"Poll ID or URL"`
	OriginalOrder bool   `help:"Show timeslots in original poll order instead of best availability first" name:"original-order"`
}

MeetingResultsCmd displays meeting poll availability as a timeslot-by-participant grid.

func (*MeetingResultsCmd) Run

func (c *MeetingResultsCmd) Run(flags *RootFlags) error

Run fetches meeting poll and results, renders availability grid.

type MeetingUpdateCmd

type MeetingUpdateCmd struct {
	ID       string   `arg:"" required:"" help:"Meeting poll ID or URL"`
	Title    string   `help:"New poll title" short:"t"`
	Location string   `help:"Meeting location"`
	AddDate  []string `help:"Add all-day date YYYY-MM-DD (repeatable)" short:"d"`
	AddRange []string `help:"Add time range 'YYYY-MM-DD HH:MM-HH:MM' (repeatable)" short:"r"`
	Tz       string   `help:"IANA timezone (e.g. Europe/Berlin)"`
}

MeetingUpdateCmd updates an existing meeting poll.

func (*MeetingUpdateCmd) Run

func (c *MeetingUpdateCmd) Run(flags *RootFlags) error

Run updates a meeting poll via the API.

type PollCmd

type PollCmd struct {
	Create  PollCreateCmd  `cmd:"" help:"Create a multiple-choice poll"`
	Get     PollGetCmd     `cmd:"" help:"Get poll details"`
	Results PollResultsCmd `cmd:"" help:"View poll results"`
	Delete  PollDeleteCmd  `cmd:"" help:"Delete a poll"`
	Update  PollUpdateCmd  `cmd:"" help:"Update a poll"`
	Reset   PollResetCmd   `cmd:"" help:"Reset poll results"`
	List    PollListCmd    `cmd:"" help:"List your polls"`
}

PollCmd groups poll subcommands.

type PollCreateCmd

type PollCreateCmd struct {
	Title   string   `arg:"" optional:"" help:"Poll title"`
	Options []string `arg:"" optional:"" help:"Poll options (2-30)"`

	// Voting Rules group
	Dupcheck          string `help:"Duplication checking: ip, session, none" default:"ip" group:"voting"`
	IsMultipleChoice  bool   `help:"Allow selecting multiple options" group:"voting"`
	MultipleChoiceMin int    `help:"Minimum selections (requires --is-multiple-choice)" group:"voting"`
	MultipleChoiceMax int    `help:"Maximum selections (requires --is-multiple-choice)" group:"voting"`
	AllowOther        bool   `help:"Allow voters to add options" group:"voting"`
	RequireNames      bool   `help:"Require voter names" group:"voting"`

	// Privacy & Access group
	IsPrivate        bool   `help:"Hide from public listings" group:"privacy"`
	ResultsVis       string `help:"Results visibility: always, after_deadline, after_vote, hidden" default:"always" group:"privacy"`
	HideParticipants bool   `help:"Hide participant names" group:"privacy"`
	AllowVPN         bool   `help:"Allow VPN users" default:"true" group:"privacy"`
	EditVotePerms    string `help:"Who can edit votes: admin, admin_voter, voter, nobody" default:"admin_voter" group:"privacy"`

	// Display & Scheduling group
	Deadline      string `help:"Deadline (RFC3339 or duration like 24h)" group:"display"`
	Randomize     bool   `help:"Randomize option order" group:"display"`
	AllowComments bool   `help:"Allow comments on poll" group:"display"`
}

PollCreateCmd creates a multiple-choice poll.

func (*PollCreateCmd) Run

func (c *PollCreateCmd) Run(flags *RootFlags) error

Run creates a poll via the API. If title and options are provided as args, uses the flag path directly. Otherwise, launches an interactive wizard in TTY or errors in a pipe.

type PollDeleteCmd

type PollDeleteCmd struct {
	ID    string `arg:"" required:"" help:"Poll ID or URL"`
	Force bool   `help:"Skip confirmation prompt" short:"f"`
}

PollDeleteCmd deletes a poll.

func (*PollDeleteCmd) Run

func (c *PollDeleteCmd) Run(_ *RootFlags) error

Run deletes a poll, prompting for confirmation unless --force.

type PollGetCmd

type PollGetCmd struct {
	ID string `arg:"" required:"" help:"Poll ID or URL"`
}

PollGetCmd retrieves poll details.

func (*PollGetCmd) Run

func (c *PollGetCmd) Run(flags *RootFlags) error

Run fetches and displays a poll.

type PollListCmd

type PollListCmd struct {
	Limit int    `help:"Polls per page" default:"20"`
	Page  int    `help:"Page number" default:"1"`
	Type  string `help:"Poll type: created or participated" default:"created" enum:"created,participated"`
}

PollListCmd lists the user's polls.

func (*PollListCmd) Run

func (c *PollListCmd) Run(flags *RootFlags) error

Run lists polls via the API.

type PollResetCmd

type PollResetCmd struct {
	ID    string `arg:"" required:"" help:"Poll ID or URL"`
	Force bool   `help:"Skip confirmation prompt" short:"f"`
}

PollResetCmd resets poll results.

func (*PollResetCmd) Run

func (c *PollResetCmd) Run(_ *RootFlags) error

Run resets poll results, prompting for confirmation unless --force.

type PollResultsCmd

type PollResultsCmd struct {
	ID           string `arg:"" required:"" help:"Poll ID or URL"`
	Participants bool   `help:"Show per-participant breakdown" short:"p"`
}

PollResultsCmd displays poll results.

func (*PollResultsCmd) Run

func (c *PollResultsCmd) Run(flags *RootFlags) error

Run fetches and displays poll results.

type PollUpdateCmd

type PollUpdateCmd struct {
	ID           string   `arg:"" required:"" help:"Poll ID or URL"`
	Title        string   `help:"New poll title" short:"t"`
	AddOption    []string `help:"Add option (repeatable)" short:"a"`
	RemoveOption []int    `help:"Remove option by position index (repeatable)" short:"r"`
}

PollUpdateCmd updates an existing poll.

func (*PollUpdateCmd) Run

func (c *PollUpdateCmd) Run(flags *RootFlags) error

Run updates a poll via the API.

type RankingCmd

type RankingCmd struct {
	Create  RankingCreateCmd  `cmd:"" help:"Create a ranking poll"`
	Get     RankingGetCmd     `cmd:"" help:"Get ranking poll details"`
	Results RankingResultsCmd `cmd:"" help:"View ranking results"`
	Delete  RankingDeleteCmd  `cmd:"" help:"Delete a ranking poll"`
	Update  RankingUpdateCmd  `cmd:"" help:"Update a ranking poll"`
	List    RankingListCmd    `cmd:"" help:"List ranking polls"`
}

RankingCmd groups ranking poll subcommands.

type RankingCreateCmd

type RankingCreateCmd struct {
	Title   string   `arg:"" required:"" help:"Poll title"`
	Options []string `arg:"" required:"" help:"Ranking options (2-30)"`

	// Voting Rules group
	Dupcheck string `help:"Duplication checking: ip, session, none" default:"ip" group:"voting"`

	// Privacy & Access group
	IsPrivate  bool   `help:"Hide from public listings" group:"privacy"`
	ResultsVis string `help:"Results visibility: always, after_deadline, after_vote, hidden" default:"always" group:"privacy"`

	// Display & Scheduling group
	Deadline      string `help:"Deadline (RFC3339 or duration like 24h)" group:"display"`
	AllowComments bool   `help:"Allow comments on poll" group:"display"`
	Description   string `help:"Poll description" group:"display"`
}

RankingCreateCmd creates a ranking poll.

func (*RankingCreateCmd) Run

func (c *RankingCreateCmd) Run(flags *RootFlags) error

Run creates a ranking poll via the API.

type RankingDeleteCmd

type RankingDeleteCmd struct {
	ID    string `arg:"" required:"" help:"Poll ID or URL"`
	Force bool   `help:"Skip confirmation prompt" short:"f"`
}

RankingDeleteCmd deletes a ranking poll.

func (*RankingDeleteCmd) Run

func (c *RankingDeleteCmd) Run(_ *RootFlags) error

Run deletes a ranking poll, prompting for confirmation unless --force.

type RankingGetCmd

type RankingGetCmd struct {
	ID string `arg:"" required:"" help:"Poll ID or URL"`
}

RankingGetCmd retrieves ranking poll details.

func (*RankingGetCmd) Run

func (c *RankingGetCmd) Run(flags *RootFlags) error

Run fetches and displays a ranking poll.

type RankingListCmd

type RankingListCmd struct {
	Limit int `help:"Max results per page" default:"20" short:"l"`
	Page  int `help:"Page number" default:"1" short:"p"`
}

RankingListCmd lists the user's ranking polls.

func (*RankingListCmd) Run

func (c *RankingListCmd) Run(flags *RootFlags) error

Run lists ranking polls with client-side type filtering.

type RankingResultsCmd

type RankingResultsCmd struct {
	ID      string `arg:"" required:"" help:"Poll ID or URL"`
	Verbose bool   `help:"Show per-option position breakdown" short:"v"`
}

RankingResultsCmd displays ranking poll results with Borda count scoring.

func (*RankingResultsCmd) Run

func (c *RankingResultsCmd) Run(flags *RootFlags) error

Run fetches ranking results and displays Borda count scores.

type RankingUpdateCmd

type RankingUpdateCmd struct {
	ID           string   `arg:"" required:"" help:"Poll ID or URL"`
	Title        string   `help:"New poll title" short:"t"`
	AddOption    []string `help:"Add option (repeatable)" short:"a"`
	RemoveOption []int    `help:"Remove option by position index (repeatable)" short:"r"`
}

RankingUpdateCmd updates an existing ranking poll.

func (*RankingUpdateCmd) Run

func (c *RankingUpdateCmd) Run(flags *RootFlags) error

Run updates a ranking poll via the API.

type RootFlags

type RootFlags struct {
	JSON    bool `help:"Output JSON to stdout" short:"j"`
	Plain   bool `help:"Output plain TSV (for scripting)"`
	NoColor bool `help:"Disable colors" env:"NO_COLOR"`
	Copy    bool `help:"Copy poll URL to clipboard"`
	Open    bool `help:"Open poll URL in browser"`
}

RootFlags are global flags available to all commands.

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run() error

Jump to

Keyboard shortcuts

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