cli

package
v0.160.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package cli contains functionality for the command-line interface of the service. It provides commands for starting both the server and scheduler services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	// Logger is a logger that the command can use.
	Logger *slog.Logger
	// StaticContent is an embedded filesystem containing static files.
	StaticContent embed.FS
	// Environment is the running environment for the application.
	Environment string
}

Arguments are the common options for commands.

func AddArguments

func AddArguments(options ...Option) *Arguments

AddArguments generates command-line arguments from the given options.

type BlockUserCmd added in v0.27.0

type BlockUserCmd struct {
	UserArgs

	Value bool `help:"Block status."`
}

func (*BlockUserCmd) Run added in v0.27.0

func (c *BlockUserCmd) Run() error

type ClearSchedulerCmd added in v0.24.0

type ClearSchedulerCmd struct{}

ClearSchedulerCmd is a cli command for clearing the scheduled jobs queue.

func (*ClearSchedulerCmd) Run added in v0.24.0

func (c *ClearSchedulerCmd) Run(opts *Arguments) error

Run runs the clear command that will remove all scheduled jobs.

type CreateIndexCmd added in v0.87.0

type CreateIndexCmd struct {
	schema.IndicesOptions
}

func (*CreateIndexCmd) Run added in v0.87.0

func (r *CreateIndexCmd) Run(opts *CreateIndexCmd) error

type DataCmd

type DataCmd struct {
	Delete DeleteCmd `cmd:"delete" help:"Delete objects"`
}

DataCmd defines the `data` command, which contains commands for manipulating data.

type DeleteCmd

type DeleteCmd struct {
	ObjectID string `arg:"" help:"ID of object to delete"`
}

func (*DeleteCmd) Run

func (c *DeleteCmd) Run(opts *DeleteCmd) error

type DeleteJobSchedulerCmd added in v0.102.0

type DeleteJobSchedulerCmd struct {
	ID    string `arg:"" help:"The job ID."`
	Group string `arg:"" help:"The job group (optional)." optional:""`
}

DeleteJobSchedulerCmd is a cli command for deleting a scheduled job.

func (*DeleteJobSchedulerCmd) Run added in v0.102.0

func (c *DeleteJobSchedulerCmd) Run(opts *Arguments) error

Run runs the delete-job scheduler command.

type DeleteUserCmd added in v0.27.0

type DeleteUserCmd struct {
	UserArgs
}

func (*DeleteUserCmd) Run added in v0.27.0

func (c *DeleteUserCmd) Run() error

type ElasticCmd added in v0.87.0

type ElasticCmd struct {
	Indices IndicesCmd `cmd:"indices" help:"Perform operations on indices."`
	ILM     ILMCmd     `cmd:"ilm"     help:"Perform ILM operations."`
}

ElasticCmd contains commands for manipulating Elasticsearch.

type FeedCmd added in v0.71.0

type FeedCmd struct {
	Fetch        FetchFeedCmd        `cmd:"fetch"         help:"fetch a feed (by either URL or ID)"`
	ResetUpdates ResetFeedUpdatesCmd `cmd:"reset-updates" help:"reset the feed updates job"`
}

FeedCmd contains sub commands for interacting with feeds.

type FetchFeedCmd added in v0.71.0

type FetchFeedCmd struct {
	FeedID   models.FeedID `help:"ID of feed"`
	FeedURL  string        `help:"URL of feed"`
	Validate bool          `help:"validate the feed" default:"false"`
}

FetchFeedCmd is a command that will fetch a feed, by either URL or its Feed ID.

func (*FetchFeedCmd) Run added in v0.71.0

func (c *FetchFeedCmd) Run() error

Run performs the operations for fetching feed details.

type ILMCmd added in v0.87.0

type ILMCmd struct {
	Update UpdateILMPoliciesCmd `cmd:"update" help:"Update ILM policies."`
}

type IndicesCmd added in v0.87.0

type IndicesCmd struct {
	Update  UpdateIndexSchemaCmd `cmd:"update"  help:"Update schema(s)"`
	Migrate MigrateIndexCmd      `cmd:"migrate" help:"Migrate data"`
	Create  CreateIndexCmd       `cmd:"create"  help:"Create indices"`
}

IndicesCmd contains commands for manipulating Elasticsearch indices.

type InitSchedulerCmd added in v0.24.0

type InitSchedulerCmd struct{}

InitSchedulerCmd is a cli command to init the scheduler backend (for a new installation), without starting the scheduler.

func (*InitSchedulerCmd) Run added in v0.24.0

func (c *InitSchedulerCmd) Run(opts *Arguments) error

Run runs the clear command that will remove all scheduled jobs.

type ListJobsSchedulerCmd added in v0.102.0

type ListJobsSchedulerCmd struct{}

ListJobsSchedulerCmd is a cli command for listing all scheduled jobs.

func (*ListJobsSchedulerCmd) Run added in v0.102.0

func (c *ListJobsSchedulerCmd) Run(opts *Arguments) error

Run runs the clear command that will remove all scheduled jobs.

type MigrateIndexCmd added in v0.87.0

type MigrateIndexCmd struct {
	schema.IndicesOptions
}

func (*MigrateIndexCmd) Run added in v0.87.0

func (r *MigrateIndexCmd) Run(opts *MigrateIndexCmd) error

type Option

type Option func(*Arguments) *Arguments

Option is a functional option for the command-line.

func WithEnvironment

func WithEnvironment(env string) Option

WithEnvironment option sets the environment for the command.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger defines a logger for a command.

type ResetFeedUpdatesCmd added in v0.102.0

type ResetFeedUpdatesCmd struct {
	FeedID models.FeedID `help:"ID of feed"`
}

ResetFeedUpdatesCmd is a cli command to reset the updates for a feed. It will reset the last_fetched timestamp on the feed and delete any scheduled job for feed updates.

func (*ResetFeedUpdatesCmd) Run added in v0.102.0

func (c *ResetFeedUpdatesCmd) Run() error

Run performs the operations for resetting feed updates.

type RunSchedulerCmd

type RunSchedulerCmd struct{}

RunSchedulerCmd is a cli command for running the scheduler component.

func (*RunSchedulerCmd) Run

func (c *RunSchedulerCmd) Run(opts *Arguments) error

Run contains logic for setup and execution of the scheduler.

type SchedulerCmd

type SchedulerCmd struct {
	Run       RunSchedulerCmd       `cmd:"run"        help:"Run scheduler."`
	Clear     ClearSchedulerCmd     `cmd:"clear"      help:"Clear all jobs."`
	Init      InitSchedulerCmd      `cmd:"init"       help:"Initialise the scheduler/queue."`
	ListJobs  ListJobsSchedulerCmd  `cmd:"list-jobs"  help:"List all jobs."`
	DeleteJob DeleteJobSchedulerCmd `cmd:"delete-job" help:"Job related commands."`
}

SchedulerCmd defines the `scheduler` command, for performing job scheduler related actions.

type ServeCmd

type ServeCmd struct{}

ServeCmd defines the `server` command for running the server.

func (*ServeCmd) Run

func (r *ServeCmd) Run(opts *Arguments) error

Run performs setup and execution for the server command.

type UpdateILMPoliciesCmd added in v0.87.0

type UpdateILMPoliciesCmd struct {
	schema.ILMOptions
}

func (*UpdateILMPoliciesCmd) Run added in v0.87.0

type UpdateIndexSchemaCmd added in v0.87.0

type UpdateIndexSchemaCmd struct {
	schema.IndicesOptions
}

func (*UpdateIndexSchemaCmd) Run added in v0.87.0

type UserArgs added in v0.92.0

type UserArgs struct {
	UserID models.UserID `arg:"" help:"ID of object to delete"`
}

type UserCmd added in v0.27.0

type UserCmd struct {
	Delete DeleteUserCmd `cmd:"delete" help:"Delete user"`
	Block  BlockUserCmd  `cmd:"delete" help:"Block user"`
}

UserCmd contains sub commands for managing users.

Jump to

Keyboard shortcuts

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