cmd

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(ctx server.Cmd) (*httpclient.Client, error)

Client returns an httpclient.Client configured from the global HTTP flags.

Types

type AWSConfig

type AWSConfig struct {
	AccessKey    string `name:"access-key" env:"AWS_ACCESS_KEY_ID" help:"AWS access key ID (s3://)."  optional:""`
	SecretKey    string `name:"secret-key" env:"AWS_SECRET_ACCESS_KEY" help:"AWS secret access key (s3://)." optional:""`
	SessionToken string `name:"session-token" env:"AWS_SESSION_TOKEN"     help:"AWS session token for temporary credentials (s3://)." optional:""`
	Region       string `name:"region"   env:"AWS_REGION,AWS_DEFAULT_REGION" help:"AWS region." optional:""`
	Profile      string `name:"profile"  env:"AWS_PROFILE" help:"AWS credentials profile (s3://)."  optional:""`
	Endpoint     string `name:"endpoint" help:"S3-compatible endpoint URL, e.g. http://localhost:9000 (s3://)."   optional:""`
}

type BackendsCommand

type BackendsCommand struct{}

func (*BackendsCommand) Run

func (cmd *BackendsCommand) Run(ctx server.Cmd) (err error)

type ClientCommands

type ClientCommands struct {
	Volumes  BackendsCommand `cmd:"" name:"volumes" help:"Return list of volumes." group:"SERVER"`
	List     ListCommand     `cmd:"" name:"ls" help:"List objects." group:"OBJECTS"`
	Get      GetCommand      `cmd:"" name:"cat" help:"Download an object." group:"OBJECTS"`
	Head     HeadCommand     `cmd:"" name:"head" help:"Get object metadata." group:"OBJECTS"`
	Delete   DeleteCommand   `cmd:"" name:"rm" help:"Delete an object or prefix." group:"OBJECTS"`
	Upload   UploadCommand   `cmd:"" name:"upload" help:"Upload a file or directory." group:"OBJECTS"`
	Download DownloadCommand `cmd:"" name:"download" help:"Download an object to a file or directory." group:"OBJECTS"`
}

type DeleteCommand

type DeleteCommand struct {
	Volume    string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path      string `arg:"" name:"path" help:"Object path or prefix"`
	Recursive bool   `name:"recursive" short:"r" help:"Delete all objects under path, including subdirectories"`
}

func (*DeleteCommand) Run

func (cmd *DeleteCommand) Run(globals server.Cmd) (err error)

type DownloadCommand

type DownloadCommand struct {
	Volume string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path   string `arg:"" name:"path" help:"Local directory to download into (defaults to current directory)." optional:""`
	Prefix string `name:"prefix" short:"p" help:"Remote path prefix to download (e.g. backups/2026)."`
	Force  bool   `name:"force" short:"f" help:"Download every file even when the local copy appears up to date."`
}

func (*DownloadCommand) Run

func (cmd *DownloadCommand) Run(globals server.Cmd) (err error)

type GetCommand

type GetCommand struct {
	Volume string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path   string `arg:"" name:"path" help:"Object path (e.g. /dir/file.txt)"`
	Output string `name:"output" short:"o" help:"Write to file instead of stdout"`
}

func (*GetCommand) Run

func (cmd *GetCommand) Run(globals server.Cmd) (err error)

type HeadCommand

type HeadCommand struct {
	Volume string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path   string `arg:"" name:"path" help:"Object path"`
}

func (*HeadCommand) Run

func (cmd *HeadCommand) Run(globals server.Cmd) (err error)

type ListCommand

type ListCommand struct {
	Volume    string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path      string `arg:"" name:"path" help:"Path prefix to list" optional:"" default:"/"`
	Recursive bool   `name:"recursive" short:"r" help:"List recursively"`
	Limit     int    `name:"limit" short:"n" help:"Maximum number of objects to return (default: all)."`
	Offset    int    `name:"offset" help:"Number of objects to skip (for pagination)." default:"0"`
}

func (*ListCommand) Run

func (cmd *ListCommand) Run(globals server.Cmd) (err error)

type RunServerCommand

type RunServerCommand struct {
	Backend             []string  `arg:"" name:"backend" help:"Backend URL (e.g. mem://name, file://name/path, s3://bucket)." optional:""`
	AWS                 AWSConfig `embed:"" prefix:"aws."`
	queue.PostgresFlags `embed:"" prefix:"pg."`
	queue.Queue         `embed:"" prefix:"queue."`
	cmd.RunServer
}

func (*RunServerCommand) OptsForBackend

func (cmd *RunServerCommand) OptsForBackend(ctx context.Context, backend string) ([]blob.Opt, error)

func (*RunServerCommand) Run

func (cmd *RunServerCommand) Run(globals server.Cmd) error

type ServerCommands

type ServerCommands struct {
	Run RunServerCommand `cmd:"" name:"run" help:"Run HTTP server." group:"SERVER"`
}

type UploadCommand

type UploadCommand struct {
	Volume string `name:"volume" short:"v" help:"Backend volume name (saved as default for future commands)." optional:""`
	Path   string `arg:"" name:"path" help:"Local file or directory to upload (defaults to current directory)." optional:""`
	Prefix string `name:"prefix" short:"p" help:"Remote path prefix (e.g. backups/2026)."`
	Hidden bool   `name:"hidden" help:"Include files and directories whose names begin with '.'."`
	Force  bool   `name:"force" short:"f" help:"Upload every file even when the remote copy appears up to date."`
}

func (*UploadCommand) Run

func (cmd *UploadCommand) Run(globals server.Cmd) (err error)

Jump to

Keyboard shortcuts

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