opt

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package opt defines option and parameter types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionHelps added in v0.6.0

func OptionHelps(opts []OptionType) string

OptionHelps returns a text of accepted command options with their help messages

Types

type OptionList

type OptionList []OptionType

OptionList is a slice of OptionTypes

func (OptionList) GetParams

func (l OptionList) GetParams() string

GetParams runs GetParam() on an opt.OptionList and returns a concatenated string

func (OptionList) Has

func (l OptionList) Has(check OptionType) bool

Has determines if the opt.OptionList contains this OptionType

type OptionType

type OptionType int

OptionType is a type for our options. These can be provided with optional parameters or can be already set in commandMap

const (
	DeleteSource  OptionType = iota + 1 // Delete source file/object
	IfNotExists                         // Run only if destination does not exist
	Parents                             // Just like cp --parents
	RR                                  // Reduced-redundancy
	IA                                  // Infrequent-access
	Recursive                           // Recursive copy/move (local)
	ListETags                           // Include ETags in listing
	HumanReadable                       // Human Readable file sizes (ls, du)
	GroupByClass                        // Group by storage class (du)
	IfSizeDiffers                       // Run only if size differs (or file non-existent on destination)
	IfSourceNewer                       // Run only if source file is newer
	Help                                // Show help
)

List of OptionTypes

func (OptionType) GetParam

func (o OptionType) GetParam() string

GetParam returns the string/command parameter representation of a specific OptionType

func (OptionType) HelpMessage

func (o OptionType) HelpMessage() string

HelpMessage returns the help message for a specific OptionType

type ParamType

type ParamType int

ParamType is the type of our parameter. Determines how we validate the arguments.

const (
	Unchecked          ParamType = iota // Arbitrary single parameter
	UncheckedOneOrMore                  // One or more arbitrary parameters (special case)
	S3Obj                               // Bucket or bucket + key
	S3Dir                               // Bucket or bucket + key + "/" (prefix)
	S3ObjOrDir                          // Bucket or bucket + key [+ "/"]
	S3SimpleObj                         // Bucket + key
	S3WildObj                           // Bucket + key with wildcard
	FileObj                             // Filename
	Dir                                 // Dir name or non-existing name ("/" appended)
	FileOrDir                           // File or directory (if existing directory, "/" appended)
	Glob                                // String containing a valid glob pattern (non-S3)

	OptionalDir       // Optional dir name or non-existing name ("/" appended)
	OptionalFileOrDir // Optional file or directory (if existing directory, "/" appended)
)

List of ParamTypes

func (ParamType) String

func (p ParamType) String() string

String returns the string representation of ParamType

Jump to

Keyboard shortcuts

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