cmd

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ExitSuccess   = 0
	ExitGeneric   = 1
	ExitUsage     = 2
	ExitAuth      = 3
	ExitNotFound  = 4
	ExitRateLimit = 5
)

Variables

This section is empty.

Functions

func Execute

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

func ExitCode

func ExitCode(err error) int

func VersionString

func VersionString() string

Types

type AddCmd

type AddCmd struct {
	URL        string   `arg:"" optional:"" help:"URL to add (use - for stdin bulk)"`
	Collection string   `help:"Collection name or ID" default:"-1" short:"c"`
	Title      string   `help:"Override title" short:"t"`
	Tags       []string `help:"Tags (repeat flag or comma-separated)" short:"T"`
	Note       string   `help:"Note text" short:"n"`
	NoFetch    bool     `help:"Skip fetching URL metadata" name:"no-fetch"`
}

func (*AddCmd) Run

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

type AuthCmd

type AuthCmd struct {
	Setup  AuthSetupCmd  `cmd:"" help:"Configure OAuth client credentials"`
	Token  AuthTokenCmd  `cmd:"" help:"Set test token for authentication"`
	Login  AuthLoginCmd  `cmd:"" help:"Authenticate with OAuth"`
	Status AuthStatusCmd `cmd:"" help:"Show authentication status"`
	Logout AuthLogoutCmd `cmd:"" help:"Remove stored tokens"`
}

type AuthLoginCmd

type AuthLoginCmd struct {
	Manual bool `help:"Manual authorization (paste URL instead of callback server)"`
}

func (*AuthLoginCmd) Run

func (c *AuthLoginCmd) Run() error

type AuthLogoutCmd

type AuthLogoutCmd struct{}

func (*AuthLogoutCmd) Run

func (c *AuthLogoutCmd) Run() error

type AuthSetupCmd

type AuthSetupCmd struct {
	ClientID     string `arg:"" help:"OAuth client ID"`
	ClientSecret string `help:"OAuth client secret (omit to prompt securely)"`
	RedirectURI  string `help:"OAuth redirect URI (default: http://localhost:<oauth_port>/callback)"`
}

func (*AuthSetupCmd) Run

func (c *AuthSetupCmd) Run() error

type AuthStatusCmd

type AuthStatusCmd struct{}

func (*AuthStatusCmd) Run

func (c *AuthStatusCmd) Run() error

type AuthTokenCmd

type AuthTokenCmd struct {
	Token string `arg:"" help:"Test token from raindrop.io/settings/integrations"`
}

func (*AuthTokenCmd) Run

func (c *AuthTokenCmd) Run() error

type BashCompletionCmd

type BashCompletionCmd struct{}

func (*BashCompletionCmd) Run

func (c *BashCompletionCmd) Run() error

type CLI

type CLI struct {
	RootFlags `embed:""`

	Version    kong.VersionFlag `help:"Print version and exit"`
	VersionCmd VersionCmd       `cmd:"" name:"version" help:"Print version"`
	Config     ConfigCmd        `cmd:"" help:"Manage configuration"`
	Auth       AuthCmd          `cmd:"" help:"Authentication and credentials"`

	// Core commands
	Add         AddCmd         `cmd:"" help:"Add a bookmark"`
	List        ListCmd        `cmd:"" help:"List bookmarks"`
	Get         GetCmd         `cmd:"" help:"Get bookmark details"`
	Update      UpdateCmd      `cmd:"" help:"Update a bookmark"`
	Delete      DeleteCmd      `cmd:"" help:"Delete a bookmark"`
	Search      SearchCmd      `cmd:"" help:"Search bookmarks"`
	Collections CollectionsCmd `cmd:"" help:"Manage collections"`
	Tags        TagsCmd        `cmd:"" help:"Manage tags"`
	Highlights  HighlightsCmd  `cmd:"" help:"Manage highlights"`

	// Utility commands
	Import     ImportCmd     `cmd:"" help:"Import bookmarks from HTML file"`
	Export     ExportCmd     `cmd:"" help:"Export bookmarks"`
	Open       OpenCmd       `cmd:"" help:"Open bookmark in browser"`
	Copy       CopyCmd       `cmd:"" help:"Copy bookmark URL to clipboard"`
	Completion CompletionCmd `cmd:"" help:"Generate shell completions"`
}

type CollectionsCmd

type CollectionsCmd struct {
	List   CollectionsListCmd   `cmd:"" default:"1" help:"List collections"`
	Get    CollectionsGetCmd    `cmd:"" help:"Get collection details"`
	Create CollectionsCreateCmd `cmd:"" help:"Create a collection"`
	Update CollectionsUpdateCmd `cmd:"" help:"Update a collection"`
	Delete CollectionsDeleteCmd `cmd:"" help:"Delete a collection"`
}

type CollectionsCreateCmd

type CollectionsCreateCmd struct {
	Name   string `arg:"" help:"Collection name"`
	Parent string `help:"Parent collection name/ID" short:"p"`
	Color  string `help:"Color hex code (e.g., #ff0000)" short:"c"`
}

func (*CollectionsCreateCmd) Run

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

type CollectionsDeleteCmd

type CollectionsDeleteCmd struct {
	Collection string `arg:"" help:"Collection name or ID"`
}

func (*CollectionsDeleteCmd) Run

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

type CollectionsGetCmd

type CollectionsGetCmd struct {
	Collection string `arg:"" help:"Collection name or ID"`
}

func (*CollectionsGetCmd) Run

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

type CollectionsListCmd

type CollectionsListCmd struct {
	Flat bool `help:"Flat list instead of tree" short:"f"`
}

func (*CollectionsListCmd) Run

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

type CollectionsUpdateCmd

type CollectionsUpdateCmd struct {
	Collection string `arg:"" help:"Collection name or ID"`
	Name       string `help:"New name" short:"n"`
	Color      string `help:"New color" short:"c"`
}

func (*CollectionsUpdateCmd) Run

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

type CompletionCmd

type CompletionCmd struct {
	Bash BashCompletionCmd `cmd:"" help:"Generate bash completion script"`
	Zsh  ZshCompletionCmd  `cmd:"" help:"Generate zsh completion script"`
	Fish FishCompletionCmd `cmd:"" help:"Generate fish completion script"`
}

type ConfigCmd

type ConfigCmd struct {
	Path ConfigPathCmd `cmd:"" help:"Show configuration paths"`
	Get  ConfigGetCmd  `cmd:"" help:"Get configuration value"`
	Set  ConfigSetCmd  `cmd:"" help:"Set configuration value"`
}

type ConfigGetCmd

type ConfigGetCmd struct {
	Key string `arg:"" help:"Configuration key (default_output, timezone, oauth_port)"`
}

func (*ConfigGetCmd) Run

func (c *ConfigGetCmd) Run() error

type ConfigPathCmd

type ConfigPathCmd struct{}

func (*ConfigPathCmd) Run

func (c *ConfigPathCmd) Run() error

type ConfigSetCmd

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

func (*ConfigSetCmd) Run

func (c *ConfigSetCmd) Run() error

type CopyCmd

type CopyCmd struct {
	ID int `arg:"" help:"Raindrop ID"`
}

func (*CopyCmd) Run

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

type DeleteCmd

type DeleteCmd struct {
	ID        int  `arg:"" help:"Raindrop ID"`
	Permanent bool `help:"Permanently delete (skip trash)" short:"p"`
}

func (*DeleteCmd) Run

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

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

ExitCoder interface for errors that know their exit code.

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 ExportCmd

type ExportCmd struct {
	Collection string `arg:"" optional:"" help:"Collection name/ID (default: all)" default:"0"`
	Format     string `required:"" help:"Export format (csv, html, zip)" enum:"csv,html,zip" short:"f"`
	Output     string `help:"Output file (default: stdout)" short:"o"`
}

func (*ExportCmd) Run

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

type FishCompletionCmd

type FishCompletionCmd struct{}

func (*FishCompletionCmd) Run

func (c *FishCompletionCmd) Run() error

type GetCmd

type GetCmd struct {
	ID int `arg:"" help:"Raindrop ID"`
}

func (*GetCmd) Run

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

type HighlightsAddCmd

type HighlightsAddCmd struct {
	RaindropID int    `arg:"" help:"Raindrop ID"`
	Text       string `arg:"" help:"Highlight text"`
	Note       string `help:"Annotation" short:"n"`
	Color      string `help:"Color" enum:"yellow,blue,red,green,purple" default:"yellow" short:"c"`
}

func (*HighlightsAddCmd) Run

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

type HighlightsCmd

type HighlightsCmd struct {
	List   HighlightsListCmd   `cmd:"" help:"List highlights for a raindrop"`
	Add    HighlightsAddCmd    `cmd:"" help:"Add a highlight"`
	Delete HighlightsDeleteCmd `cmd:"" help:"Delete a highlight"`
}

type HighlightsDeleteCmd

type HighlightsDeleteCmd struct {
	RaindropID  int    `arg:"" help:"Raindrop ID"`
	HighlightID string `arg:"" help:"Highlight ID"`
}

func (*HighlightsDeleteCmd) Run

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

type HighlightsListCmd

type HighlightsListCmd struct {
	ID int `arg:"" help:"Raindrop ID"`
}

func (*HighlightsListCmd) Run

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

type ImportCmd

type ImportCmd struct {
	File string `arg:"" help:"Netscape bookmark HTML file" type:"existingfile"`
}

func (*ImportCmd) Run

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

type ListCmd

type ListCmd struct {
	Collection string `arg:"" optional:"" help:"Collection name/ID (default: all)" default:"0"`
	Favorites  bool   `help:"Only favorites" short:"f"`
	Broken     bool   `help:"Only broken links"`
	Type       string `help:"Filter by type (link|article|image|video|document|audio)" short:"t"`
	Tag        string `help:"Filter by tag"`
	Search     string `help:"Search query" short:"s"`
	Sort       string `help:"Sort order" default:"-created" enum:"created,-created,title,-title,domain,-domain,score"`
	All        bool   `help:"Fetch all pages (default: first 50)" short:"a"`
}

func (*ListCmd) Run

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

type OpenCmd

type OpenCmd struct {
	ID int `arg:"" help:"Raindrop ID"`
}

func (*OpenCmd) Run

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

type RootFlags

type RootFlags struct {
	JSON       bool   `help:"Output JSON to stdout (best for scripting)"`
	Verbose    bool   `help:"Enable verbose logging"`
	Force      bool   `help:"Skip confirmations"`
	NoInput    bool   `help:"Fail instead of prompting (CI mode)" name:"no-input"`
	Hyperlinks string `help:"Hyperlink mode: auto, on, off" default:"auto" enum:"auto,on,off"`
}

func (*RootFlags) HyperlinkMode

func (f *RootFlags) HyperlinkMode() output.HyperlinkMode

HyperlinkMode returns the parsed hyperlink mode.

type SearchCmd

type SearchCmd struct {
	Query      string `arg:"" optional:"" help:"Search query"`
	Tag        string `help:"Filter by tag" short:"t"`
	Type       string `help:"Filter by type (link|article|image|video|document|audio)" short:"T"`
	After      string `help:"Created after date (YYYY-MM-DD)"`
	Before     string `help:"Created before date (YYYY-MM-DD)"`
	Collection string `help:"Collection to search" default:"0" short:"c"`
	All        bool   `help:"Fetch all results" short:"a"`
}

func (*SearchCmd) Run

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

type TagsCmd

type TagsCmd struct {
	List   TagsListCmd   `cmd:"" default:"1" help:"List tags"`
	Rename TagsRenameCmd `cmd:"" help:"Rename a tag"`
	Merge  TagsMergeCmd  `cmd:"" help:"Merge tags into one"`
	Delete TagsDeleteCmd `cmd:"" help:"Delete tags"`
}

type TagsDeleteCmd

type TagsDeleteCmd struct {
	Tags       string `arg:"" help:"Tags to delete (comma-separated)"`
	Collection string `help:"Collection name/ID (default: all)" default:"0" short:"c"`
}

func (*TagsDeleteCmd) Run

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

type TagsListCmd

type TagsListCmd struct {
	Collection string `help:"Collection name/ID (default: all)" default:"0" short:"c"`
}

func (*TagsListCmd) Run

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

type TagsMergeCmd

type TagsMergeCmd struct {
	Tags       string `arg:"" help:"Tags to merge (comma-separated)"`
	Into       string `help:"Target tag name" required:""`
	Collection string `help:"Collection name/ID (default: all)" default:"0" short:"c"`
}

func (*TagsMergeCmd) Run

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

type TagsRenameCmd

type TagsRenameCmd struct {
	Old        string `arg:"" help:"Current tag name"`
	New        string `arg:"" help:"New tag name"`
	Collection string `help:"Collection name/ID (default: all)" default:"0" short:"c"`
}

func (*TagsRenameCmd) Run

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

type UpdateCmd

type UpdateCmd struct {
	ID         int      `arg:"" help:"Raindrop ID"`
	Title      string   `help:"New title" short:"t"`
	Collection string   `help:"Move to collection" short:"c"`
	Tags       []string `help:"Replace tags" short:"T"`
	Note       string   `help:"Update note" short:"n"`
	Favorite   bool     `help:"Mark as favorite" short:"f"`
	Unfavorite bool     `help:"Remove favorite"`
}

func (*UpdateCmd) Run

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

type VersionCmd

type VersionCmd struct{}

func (*VersionCmd) Run

func (c *VersionCmd) Run() error

type ZshCompletionCmd

type ZshCompletionCmd struct{}

func (*ZshCompletionCmd) Run

func (c *ZshCompletionCmd) Run() error

Jump to

Keyboard shortcuts

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