command

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppCommand

func AppCommand(name string) *cli.Command

func Commands

func Commands() []*cli.Command

func ListBuckets

func ListBuckets(ctx context.Context, storageOpts storage.Options) error

ListBuckets prints all buckets.

func Main

func Main(ctx context.Context, args []string) error

Main is the entrypoint function to run given commands.

func NewBucketVersionCommand

func NewBucketVersionCommand() *cli.Command

func NewCatCommand

func NewCatCommand() *cli.Command

func NewCopyCommand

func NewCopyCommand() *cli.Command

func NewCopyCommandFlags

func NewCopyCommandFlags() []cli.Flag

func NewDeleteCommand

func NewDeleteCommand() *cli.Command

func NewListCommand

func NewListCommand() *cli.Command

func NewMakeBucketCommand

func NewMakeBucketCommand() *cli.Command

func NewMoveCommand

func NewMoveCommand() *cli.Command

func NewPipeCommand

func NewPipeCommand() *cli.Command

func NewPipeCommandFlags

func NewPipeCommandFlags() []cli.Flag

func NewPresignCommand

func NewPresignCommand() *cli.Command

func NewRemoveBucketCommand

func NewRemoveBucketCommand() *cli.Command

func NewRunCommand

func NewRunCommand() *cli.Command

func NewSelectCommand

func NewSelectCommand() *cli.Command

func NewSharedFlags

func NewSharedFlags() []cli.Flag

func NewSizeCommand

func NewSizeCommand() *cli.Command

func NewStorageOpts

func NewStorageOpts(c *cli.Context) storage.Options

NewStorageOpts creates storage.Options object from the given context.

func NewSyncCommand

func NewSyncCommand() *cli.Command

func NewSyncCommandFlags

func NewSyncCommandFlags() []cli.Flag

func NewVersionCommand

func NewVersionCommand() *cli.Command

Types

type BucketVersion

type BucketVersion struct {
	// contains filtered or unexported fields
}

func (BucketVersion) Run

func (v BucketVersion) Run(ctx context.Context) error

type BucketVersionMessage

type BucketVersionMessage struct {
	Bucket string `json:"bucket"`
	Status string `json:"status"`
	// contains filtered or unexported fields
}

func (BucketVersionMessage) JSON

func (v BucketVersionMessage) JSON() string

func (BucketVersionMessage) String

func (v BucketVersionMessage) String() string

type Cat

type Cat struct {
	// contains filtered or unexported fields
}

Cat holds cat operation flags and states.

func (Cat) Run

func (c Cat) Run(ctx context.Context) error

Run prints content of given source to standard output.

type Copy

type Copy struct {
	// contains filtered or unexported fields
}

Copy holds copy operation flags and states.

func NewCopy

func NewCopy(c *cli.Context, deleteSource bool) (*Copy, error)

NewCopy creates Copy from cli.Context.

func (Copy) Run

func (c Copy) Run(ctx context.Context) error

Run starts copying given source objects to destination.

type Delete

type Delete struct {
	// contains filtered or unexported fields
}

Delete holds delete operation flags and states.

func (Delete) Run

func (d Delete) Run(ctx context.Context) error

Run remove given sources.

type EnumValue

type EnumValue struct {
	Enum    []string
	Default string
	// ConditionFunction is used to check if the value passed to Set method is valid
	// or not.
	// If ConditionFunction is not set, it defaults to string '==' comparison.
	ConditionFunction func(str, target string) bool
	// contains filtered or unexported fields
}

func (EnumValue) Get

func (e EnumValue) Get() interface{}

func (*EnumValue) Set

func (e *EnumValue) Set(value string) error

func (EnumValue) String

func (e EnumValue) String() string

type List

type List struct {
	// contains filtered or unexported fields
}

List holds list operation flags and states.

func (List) Run

func (l List) Run(ctx context.Context) error

Run prints objects at given source.

type ListMessage

type ListMessage struct {
	Object *storage.Object `json:"object"`
	// contains filtered or unexported fields
}

ListMessage is a structure for logging ls results.

func (ListMessage) JSON

func (l ListMessage) JSON() string

JSON returns the JSON representation of ListMessage.

func (ListMessage) String

func (l ListMessage) String() string

String returns the string representation of ListMessage.

type MakeBucket

type MakeBucket struct {
	// contains filtered or unexported fields
}

MakeBucket holds bucket creation operation flags and states.

func (MakeBucket) Run

func (b MakeBucket) Run(ctx context.Context) error

Run creates a bucket.

type MapFlag

type MapFlag struct {
	Name string

	Category    string
	DefaultText string
	FilePath    string
	Usage       string

	HasBeenSet bool
	Required   bool
	Hidden     bool

	Value MapValue
}

func (*MapFlag) Apply

func (f *MapFlag) Apply(set *flag.FlagSet) error

func (*MapFlag) GetDefaultText

func (f *MapFlag) GetDefaultText() string

func (*MapFlag) GetEnvVars

func (f *MapFlag) GetEnvVars() []string

func (*MapFlag) GetUsage

func (f *MapFlag) GetUsage() string

func (*MapFlag) GetValue

func (f *MapFlag) GetValue() string

func (*MapFlag) IsRequired

func (f *MapFlag) IsRequired() bool

func (*MapFlag) IsSet

func (f *MapFlag) IsSet() bool

func (*MapFlag) IsVisible

func (f *MapFlag) IsVisible() bool

func (*MapFlag) Names

func (f *MapFlag) Names() []string

func (*MapFlag) String

func (f *MapFlag) String() string

func (*MapFlag) TakesValue

func (f *MapFlag) TakesValue() bool

type MapValue

type MapValue map[string]string

func (MapValue) Get

func (m MapValue) Get() interface{}

func (MapValue) Set

func (m MapValue) Set(s string) error

func (MapValue) String

func (m MapValue) String() string

type ObjectPair

type ObjectPair struct {
	// contains filtered or unexported fields
}

type Pipe

type Pipe struct {
	// contains filtered or unexported fields
}

Pipe holds pipe operation flags and states.

func NewPipe

func NewPipe(c *cli.Context, deleteSource bool) (*Pipe, error)

NewPipe creates Pipe from cli.Context.

func (Pipe) Run

func (c Pipe) Run(ctx context.Context) error

Run starts copying stdin output to destination.

type Presign

type Presign struct {
	// contains filtered or unexported fields
}

Presign holds presign operation flags and states.

func (Presign) Run

func (c Presign) Run(ctx context.Context) error

Run prints content of given source to standard output.

type Reader

type Reader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

Reader is a cancelable reader.

func NewReader

func NewReader(ctx context.Context, r io.Reader) *Reader

NewReader creates a new reader with cancellation.

func (*Reader) Err

func (r *Reader) Err() error

Err returns encountered errors, if any.

func (*Reader) Read

func (r *Reader) Read() <-chan string

Read returns read-only channel to consume lines.

type RemoveBucket

type RemoveBucket struct {
	// contains filtered or unexported fields
}

RemoveBucket holds bucket deletion operation flags and states.

func (RemoveBucket) Run

func (b RemoveBucket) Run(ctx context.Context) error

Run removes a bucket.

type Run

type Run struct {
	// contains filtered or unexported fields
}

func NewRun

func NewRun(c *cli.Context, r io.Reader) Run

func (Run) Run

func (r Run) Run(ctx context.Context) error

type Select

type Select struct {
	// contains filtered or unexported fields
}

Select holds select operation flags and states.

func (Select) Run

func (s Select) Run(ctx context.Context) error

Run starts copying given source objects to destination.

type Size

type Size struct {
	// contains filtered or unexported fields
}

Size holds disk usage (du) operation flags and states.

func (Size) Run

func (sz Size) Run(ctx context.Context) error

Run calculates disk usage of given source.

type SizeAndModificationStrategy

type SizeAndModificationStrategy struct{}

SizeAndModificationStrategy determines to sync based on objects' both sizes and modification times. It treats source object as the source-of-truth;

time: src > dst        size: src != dst    should sync: yes
time: src > dst        size: src == dst    should sync: yes
time: src <= dst       size: src != dst    should sync: yes
time: src <= dst       size: src == dst    should sync: no

func (*SizeAndModificationStrategy) ShouldSync

func (sm *SizeAndModificationStrategy) ShouldSync(srcObj, dstObj *storage.Object) error

type SizeMessage

type SizeMessage struct {
	Source       string `json:"source"`
	StorageClass string `json:"storage_class,omitempty"`
	Count        int64  `json:"count"`
	Size         int64  `json:"size"`
	// contains filtered or unexported fields
}

SizeMessage is the structure for logging disk usage.

func (SizeMessage) JSON

func (s SizeMessage) JSON() string

JSON returns the JSON representation of SizeMessage.

func (SizeMessage) String

func (s SizeMessage) String() string

String returns the string representation of SizeMessage.

type SizeOnlyStrategy

type SizeOnlyStrategy struct{}

SizeOnlyStrategy determines to sync based on objects' file sizes.

func (*SizeOnlyStrategy) ShouldSync

func (s *SizeOnlyStrategy) ShouldSync(srcObj, dstObj *storage.Object) error

type Sync

type Sync struct {
	// contains filtered or unexported fields
}

Sync holds sync operation flags and states.

func NewSync

func NewSync(c *cli.Context) Sync

NewSync creates Sync from cli.Context

func (Sync) Run

func (s Sync) Run(c *cli.Context) error

Run compares files, plans necessary s5cmd commands to execute and executes them in order to sync source to destination.

type SyncStrategy

type SyncStrategy interface {
	ShouldSync(srcObject, dstObject *storage.Object) error
}

SyncStrategy is the interface to make decision whether given source object should be synced to destination object

func NewStrategy

func NewStrategy(sizeOnly bool) SyncStrategy

Jump to

Keyboard shortcuts

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