args

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Adjust verbosity.
	Verbose int `short:"v" type:"counter" help:"Increase verbosity; can be provided multiple times."`

	// Appends the source path to the destination path,
	// e.g., /foo/bar/baz.c remote:/tmp => /tmp/foo/bar/baz.c.
	Relative bool `short:"R" help:"use relative path names"`

	Links  bool `short:"l" help:"Copy symlinks as symlinks without following"`
	DryRun bool `short:"n" help:"Perform a trial run with no changes made"`

	// Mostly ignored, but causes a failure if publish contains any files.
	// See comments where the argument is checked for the explanation why.
	IgnoreExisting bool `hidden:"1"`

	Filter    filterArguments `short:"f" placeholder:"RULE" help:"Add a file-filtering RULE"`
	Exclude   []string        `placeholder:"PATTERN" help:"Exclude files matching this pattern" validate:"dive,max=2000"`
	Include   []string        `placeholder:"PATTERN" help:"Don't exclude files matching this pattern" validate:"dive,max=2000"`
	FilesFrom string          `placeholder:"FILE" help:"Read list of source-file names from FILE" validate:"max=2000"`

	Src  string `arg:"1" placeholder:"SRC" help:"Local path to a file or directory for sync" validate:"max=2000"`
	Dest string `arg:"1" placeholder:"[USER@]HOST:DEST" help:"Remote destination for sync" validate:"max=2000"`

	IgnoredConfig `embed:"1" group:"ignored"`
	ExodusConfig  `embed:"1" prefix:"exodus-"`
}

Config contains the subset of arguments which are returned by the parser and can affect the behavior of exodus-rsync.

func Parse

func Parse(args []string, version string, exit func(int)) Config

Parse will parse provided command-line arguments and either return a valid Config object, or call the exit function with a non-zero exit code.

func (*Config) DestPath

func (c *Config) DestPath() string

DestPath returns only the path portion of the destination argument passed on the command-line. For example, if invoked with user@host.example.com:/some/dir, this will return "/some/dir".

If relative paths are requested (-R), appends the source path to the destination path, e.g., /foo/bar/baz.c remote:/tmp => /tmp/foo/bar/baz.c.

If --files-from is used, listed files are located relative to the source path but the destination path is not altered like in the above example.

func (*Config) Excluded added in v1.3.0

func (c *Config) Excluded() []string

Excluded extracts the pattern from Filter arguments and appends it onto Exclude.

func (*Config) Included added in v1.3.0

func (c *Config) Included() []string

Included extracts the pattern from Filter arguments and appends it onto Include.

func (*Config) ValidateConfig added in v1.9.5

func (c *Config) ValidateConfig() (retErr error)

ValidateConfig enforces constraints defined by the "validate" tag on each attribute.

The name "Validate" is avoided so Config structs are not validated automatically upon creation.

type ExodusConfig

type ExodusConfig struct {
	Conf string `help:"Force usage of this configuration file." validate:"max=2000"`

	Publish string `help:"ID of existing exodus-gw publish to join." validate:"omitempty,uuid"`

	Commit string `help:"Commit publish using this mode" validate:"omitempty,max=20"`

	Diag bool `help:"Diagnostic mode, dumps various information about the environment."`
}

ExodusConfig defines arguments which are specific to exodus-rsync and not supported by rsync. To avoid clashes with rsync, all of these are prefixed with "--exodus" and there are no short flags.

type IgnoredConfig

type IgnoredConfig struct {
	Archive         bool `short:"a"`
	Recursive       bool `short:"r"`
	CopyLinks       bool `short:"L"`
	KeepDirlinks    bool `short:"K"`
	HardLinks       bool `short:"H"`
	Perms           bool `short:"p"`
	Executability   bool `short:"E"`
	Acls            bool `short:"A"`
	Xattrs          bool `short:"X"`
	Owner           bool `short:"o"`
	Group           bool `short:"g"`
	Devices         bool
	Specials        bool
	DevicesSpecials bool   `short:"D"`
	Times           bool   `short:"t"`
	Atimes          bool   `short:"U"`
	Crtimes         bool   `short:"N"`
	OmitDirTimes    bool   `short:"O"`
	Rsh             string `short:"e"`
	Delete          bool
	PruneEmptyDirs  bool `short:"m"`
	Timeout         int
	Compress        bool `short:"z"`
	Stats           bool
	ItemizeChanges  bool `short:"i"`
}

IgnoredConfig defines arguments which can be accepted for compatibility with rsync, but are ignored by exodus-rsync.

Jump to

Keyboard shortcuts

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