cmd

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpOptions

func HelpOptions() kong.HelpOptions

HelpOptions returns Kong help configuration options.

func HelpPrinter

func HelpPrinter() kong.HelpPrinter

HelpPrinter returns a custom HelpPrinter that colorizes output.

Types

type BatchCmd

type BatchCmd struct {
	Parallel int  `help:"Max parallel operations" default:"3"`
	Continue bool `help:"Continue on error" default:"true"`
}

BatchCmd executes multiple commands from JSONL input.

func (*BatchCmd) Run

func (c *BatchCmd) Run(globals *Globals) error

Run reads JSONL from stdin, executes commands, and outputs results as JSON.

type BlocksAppendCmd

type BlocksAppendCmd struct {
	Parent     string `arg:"" help:"Parent block or page ID"`
	BlocksFile string `help:"JSON file with block definitions" name:"blocks-file" type:"existingfile"`
	AfterBlock string `help:"Insert after this block ID" optional:""`
}

BlocksAppendCmd appends blocks to a parent.

func (*BlocksAppendCmd) Run

func (c *BlocksAppendCmd) Run(globals *Globals) error

type BlocksCmd

type BlocksCmd struct {
	List   BlocksListCmd   `cmd:"" help:"List child blocks"`
	Get    BlocksGetCmd    `cmd:"" help:"Get a block by ID"`
	Append BlocksAppendCmd `cmd:"" help:"Append blocks to parent"`
	Update BlocksUpdateCmd `cmd:"" help:"Update a block"`
	Delete BlocksDeleteCmd `cmd:"" help:"Delete a block"`
}

BlocksCmd groups all block commands.

type BlocksDeleteCmd

type BlocksDeleteCmd struct {
	ID string `arg:"" help:"Block ID"`
}

BlocksDeleteCmd deletes (archives) a block.

func (*BlocksDeleteCmd) Run

func (c *BlocksDeleteCmd) Run(globals *Globals) error

type BlocksGetCmd

type BlocksGetCmd struct {
	ID        string `arg:"" help:"Block ID"`
	AllFields bool   `help:"Show full block content" name:"all-fields"`
}

BlocksGetCmd retrieves a single block.

func (*BlocksGetCmd) Run

func (c *BlocksGetCmd) Run(globals *Globals) error

type BlocksListCmd

type BlocksListCmd struct {
	Parent    string `arg:"" help:"Parent block or page ID"`
	Depth     int    `help:"Max nesting depth (1-2)" default:"1"`
	AllFields bool   `help:"Show full block content" name:"all-fields"`
}

BlocksListCmd lists children of a block or page.

func (*BlocksListCmd) Run

func (c *BlocksListCmd) Run(globals *Globals) error

type BlocksUpdateCmd

type BlocksUpdateCmd struct {
	ID        string `arg:"" help:"Block ID"`
	Content   string `help:"New content (for text blocks)"`
	BlockJSON string `help:"Block update JSON" optional:"" name:"block-json"`
}

BlocksUpdateCmd updates a block.

func (*BlocksUpdateCmd) Run

func (c *BlocksUpdateCmd) Run(globals *Globals) error

type CommentsCmd

type CommentsCmd struct {
	List   CommentsListCmd   `cmd:"" help:"List comments on a page or discussion"`
	Create CommentsCreateCmd `cmd:"" help:"Create a comment"`
}

CommentsCmd groups comment commands.

type CommentsCreateCmd

type CommentsCreateCmd struct {
	Page       string `help:"Page ID to comment on" xor:"target"`
	Discussion string `help:"Discussion ID to reply to" xor:"target"`
	Text       string `help:"Comment text" required:""`
}

CommentsCreateCmd creates a comment.

func (*CommentsCreateCmd) Run

func (c *CommentsCreateCmd) Run(ctx *Context) error

type CommentsListCmd

type CommentsListCmd struct {
	Page       string `help:"Page ID" xor:"target"`
	Discussion string `help:"Discussion ID" xor:"target"`
	Limit      int    `help:"Max results" default:"100"`
}

CommentsListCmd lists comments.

func (*CommentsListCmd) Run

func (c *CommentsListCmd) Run(ctx *Context) error

type Context

type Context struct {
	Client *api.Client
	Config *config.Config
	Format output.Formatter
	Debug  bool
}

Context is the runtime context passed to all command Run methods.

type DatabasesCmd

type DatabasesCmd struct {
	List       DatabasesListCmd       `cmd:"" help:"List databases"`
	Get        DatabasesGetCmd        `cmd:"" help:"Get database by ID"`
	Query      DatabasesQueryCmd      `cmd:"" help:"Query database rows"`
	Create     DatabasesCreateCmd     `cmd:"" help:"Create a database"`
	Update     DatabasesUpdateCmd     `cmd:"" help:"Update database schema"`
	CreatePage DatabasesCreatePageCmd `cmd:"create-page" help:"Create page in database"`
}

DatabasesCmd groups all database commands.

type DatabasesCreateCmd

type DatabasesCreateCmd struct {
	Parent string `help:"Parent page ID" required:""`
	Title  string `help:"Database title" required:""`
	Schema string `help:"Schema JSON file" type:"existingfile" optional:""`
	Inline bool   `help:"Create inline database"`
}

DatabasesCreateCmd creates a new database.

func (*DatabasesCreateCmd) Run

func (c *DatabasesCreateCmd) Run(globals *Globals) error

type DatabasesCreatePageCmd

type DatabasesCreatePageCmd struct {
	Database string   `arg:"" help:"Database ID"`
	Title    string   `help:"Page title" required:""`
	Props    []string `help:"Properties in name=value format" short:"p"`
}

DatabasesCreatePageCmd creates a page in a database with simplified syntax.

func (*DatabasesCreatePageCmd) Run

func (c *DatabasesCreatePageCmd) Run(globals *Globals) error

type DatabasesGetCmd

type DatabasesGetCmd struct {
	ID        string `arg:"" help:"Database ID"`
	AllFields bool   `help:"Show all schema details" name:"all-fields"`
}

DatabasesGetCmd retrieves a database schema.

func (*DatabasesGetCmd) Run

func (c *DatabasesGetCmd) Run(globals *Globals) error

type DatabasesListCmd

type DatabasesListCmd struct {
	Limit int `help:"Max results" default:"100"`
}

DatabasesListCmd lists databases via search.

func (*DatabasesListCmd) Run

func (c *DatabasesListCmd) Run(globals *Globals) error

type DatabasesQueryCmd

type DatabasesQueryCmd struct {
	ID        string   `arg:"" help:"Database ID"`
	Where     []string `help:"Filter: Property.condition(value)" short:"w"`
	Filter    string   `help:"Filter JSON (advanced)" short:"f" optional:""`
	Sort      string   `help:"Sort JSON" short:"s" optional:""`
	Limit     int      `help:"Max results" default:"100"`
	Fields    []string `help:"Fields to include"`
	AllFields bool     `help:"Show all fields" name:"all-fields"`
}

DatabasesQueryCmd queries database rows via data_source.

func (*DatabasesQueryCmd) Run

func (c *DatabasesQueryCmd) Run(globals *Globals) error

type DatabasesUpdateCmd

type DatabasesUpdateCmd struct {
	ID         string `arg:"" help:"Database ID"`
	Title      string `help:"New title" optional:""`
	SchemaJSON string `help:"Schema changes JSON" optional:"" name:"schema-json"`
}

DatabasesUpdateCmd updates a database.

func (*DatabasesUpdateCmd) Run

func (c *DatabasesUpdateCmd) Run(globals *Globals) error

type Globals

type Globals = RootFlags

Globals is an alias for RootFlags used by some commands.

type PagesAppendMdCmd

type PagesAppendMdCmd struct {
	ID string `arg:"" help:"Page ID"`
}

PagesAppendMdCmd appends markdown content to a page.

func (*PagesAppendMdCmd) Run

func (c *PagesAppendMdCmd) Run(ctx *Context) error

Run reads markdown from stdin, converts to Notion blocks, and appends them.

type PagesArchiveCmd

type PagesArchiveCmd struct {
	ID string `arg:"" help:"Page ID"`
}

PagesArchiveCmd archives a page.

func (*PagesArchiveCmd) Run

func (c *PagesArchiveCmd) Run(ctx *Context) error

Run executes the pages archive command.

type PagesCmd

type PagesCmd struct {
	List     PagesListCmd     `cmd:"" help:"List pages"`
	Get      PagesGetCmd      `cmd:"" help:"Get a page by ID"`
	Create   PagesCreateCmd   `cmd:"" help:"Create a new page"`
	Update   PagesUpdateCmd   `cmd:"" help:"Update page properties"`
	Archive  PagesArchiveCmd  `cmd:"" help:"Archive a page"`
	Restore  PagesRestoreCmd  `cmd:"" help:"Restore an archived page"`
	AppendMd PagesAppendMdCmd `cmd:"append-md" help:"Append markdown to page"`
	ExportMd PagesExportMdCmd `cmd:"export-md" help:"Export page as markdown"`
}

PagesCmd groups all page commands.

type PagesCreateCmd

type PagesCreateCmd struct {
	Parent string `help:"Parent page or database ID" required:""`
	Title  string `help:"Page title" required:""`
	Props  string `help:"Properties JSON" optional:""`
}

PagesCreateCmd creates a new page.

func (*PagesCreateCmd) Run

func (c *PagesCreateCmd) Run(ctx *Context) error

Run executes the pages create command.

type PagesExportMdCmd

type PagesExportMdCmd struct {
	ID    string `arg:"" help:"Page ID"`
	Depth int    `help:"Max nesting depth" default:"4"`
}

PagesExportMdCmd exports page blocks as markdown.

func (*PagesExportMdCmd) Run

func (c *PagesExportMdCmd) Run(ctx *Context) error

Run fetches all blocks from the page and outputs markdown.

type PagesGetCmd

type PagesGetCmd struct {
	ID        string   `arg:"" help:"Page ID"`
	Fields    []string `help:"Fields to include" short:"f"`
	AllFields bool     `help:"Show all fields" name:"all-fields"`
}

PagesGetCmd retrieves a single page.

func (*PagesGetCmd) Run

func (c *PagesGetCmd) Run(ctx *Context) error

Run executes the pages get command.

type PagesListCmd

type PagesListCmd struct {
	Database string   `help:"Data source ID to query (from 'databases list')" optional:""`
	Where    []string `help:"Filter: Property.condition(value)" short:"w"`
	Filter   string   `help:"Filter JSON (advanced)" optional:""`
	Sort     string   `help:"Sort JSON" optional:""`
	Limit    int      `help:"Max results" default:"100"`
	Fields   []string `help:"Properties to show as columns" short:"f"`
}

PagesListCmd lists all accessible pages via search.

func (*PagesListCmd) Run

func (c *PagesListCmd) Run(ctx *Context) error

Run executes the pages list command.

type PagesRestoreCmd

type PagesRestoreCmd struct {
	ID string `arg:"" help:"Page ID"`
}

PagesRestoreCmd restores an archived page.

func (*PagesRestoreCmd) Run

func (c *PagesRestoreCmd) Run(ctx *Context) error

Run executes the pages restore command.

type PagesUpdateCmd

type PagesUpdateCmd struct {
	ID        string   `arg:"" help:"Page ID"`
	Set       []string `help:"Set property: name=value" short:"s"`
	PropsJSON string   `help:"Properties JSON" optional:"" name:"props-json"`
}

PagesUpdateCmd updates page properties.

func (*PagesUpdateCmd) Run

func (c *PagesUpdateCmd) Run(ctx *Context) error

Run executes the pages update command.

type RootFlags

type RootFlags struct {
	JSON    bool   `help:"Output JSON" group:"output"`
	Plain   bool   `help:"Output plain text (TSV)" group:"output"`
	Profile string `help:"Config profile to use" env:"NOTION_PROFILE"`
	Debug   bool   `help:"Enable debug output"`
	Token   string `help:"API token (overrides profile)" env:"NOTION_TOKEN"`
}

RootFlags holds global flags shared across all commands.

type SearchCmd

type SearchCmd struct {
	Query     string `arg:"" help:"Search query" optional:""`
	Type      string `help:"Filter by type: page, database" short:"t" enum:"page,database," default:""`
	Sort      string `help:"Sort direction: ascending, descending" enum:"ascending,descending" default:"descending"`
	SortField string `help:"Sort by: last_edited_time" default:"last_edited_time" name:"sort-field"`
	Limit     int    `help:"Max results" default:"100"`
}

SearchCmd searches the workspace.

func (*SearchCmd) Run

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

type UsersCmd

type UsersCmd struct {
	List UsersListCmd `cmd:"" help:"List workspace users"`
	Get  UsersGetCmd  `cmd:"" help:"Get user by ID"`
	Me   UsersMeCmd   `cmd:"" help:"Get current bot user"`
}

UsersCmd groups user commands.

type UsersGetCmd

type UsersGetCmd struct {
	ID string `arg:"" help:"User ID"`
}

UsersGetCmd gets a user by ID.

func (*UsersGetCmd) Run

func (c *UsersGetCmd) Run(ctx *Context) error

type UsersListCmd

type UsersListCmd struct {
	Limit int `help:"Max results" default:"100"`
}

UsersListCmd lists all users.

func (*UsersListCmd) Run

func (c *UsersListCmd) Run(ctx *Context) error

type UsersMeCmd

type UsersMeCmd struct{}

UsersMeCmd gets the current bot user.

func (*UsersMeCmd) Run

func (c *UsersMeCmd) Run(ctx *Context) error

Jump to

Keyboard shortcuts

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