Documentation
¶
Overview ¶
Package rsyncopts implements a parser for command-line options that implements a subset of popt(3) semantics; just enough to parse typical rsync(1) invocations without the advanced popt features like aliases or option prefix matching (not --del, only --delete).
If we encounter arguments that rsync(1) parses differently compared to this package, then this package should be adjusted to match rsync(1).
Index ¶
- Constants
- type Context
- type GokrazyOptions
- type Options
- func (o *Options) AlwaysChecksum() bool
- func (o *Options) ConnectTimeoutSeconds() int
- func (o *Options) Daemon() bool
- func (o *Options) DeleteMode() bool
- func (o *Options) DryRun() bool
- func (o *Options) Help() string
- func (o *Options) LocalServer() bool
- func (o *Options) PreserveDevices() bool
- func (o *Options) PreserveGid() bool
- func (o *Options) PreserveHardLinks() bool
- func (o *Options) PreserveLinks() bool
- func (o *Options) PreserveMTimes() bool
- func (o *Options) PreservePerms() bool
- func (o *Options) PreserveSpecials() bool
- func (o *Options) PreserveUid() bool
- func (o *Options) Recurse() bool
- func (o *Options) Sender() bool
- func (o *Options) Server() bool
- func (o *Options) SetLocalServer()
- func (o *Options) SetSender()
- func (o *Options) ShellCommand() string
- func (o *Options) UpdateOnly() bool
- func (o *Options) Verbose() bool
- type PoptError
Constants ¶
const ( POPT_ARG_NONE = iota // int; No argument expected POPT_ARG_STRING // char*; No type checking to be performed POPT_ARG_INT // int; An integer argument is expected POPT_ARG_LONG // long; A long integer is expected POPT_ARG_INCLUDE_TABLE // nest another option table POPT_ARG_CALLBACK // call a function POPT_ARG_INTL_DOMAIN // <not documented in popt(3)> POPT_ARG_VAL // int; Integer value taken from val POPT_ARG_FLOAT // float; A float argument is expected POPT_ARG_DOUBLE // double; A double argument is expected POPT_ARG_LONGLONG // long long; A long long integer is expected POPT_ARG_MAINCALL = 16 + 11 POPT_ARG_ARGV = 12 POPT_ARG_SHORT = 13 POPT_ARG_BITSET = 16 + 14 )
see popt(3)
const ( POPT_ERROR_NOARG = -10 // missing argument POPT_ERROR_BADOPT = -11 // unknown option POPT_ERROR_UNWANTEDARG = -12 // option does not take an argument POPT_ERROR_OPTSTOODEEP = -13 // aliases nested too deeply POPT_ERROR_BADQUOTE = -15 // error in parameter quoting POPT_ERROR_ERRNO = -16 // errno set, use strerror(errno) POPT_ERROR_BADNUMBER = -17 // invalid numeric value POPT_ERROR_OVERFLOW = -18 // number too large or too small POPT_ERROR_BADOPERATION = -19 // mutually exclusive logical operations requested POPT_ERROR_NULLARG = -20 // opt->arg should not be NULL POPT_ERROR_MALLOC = -21 // memory allocation failed POPT_ERROR_BADCONFIG = -22 // config file failed sanity test )
TODO(later): turn these into sentinel error values which stringify like poptStrerror()
const ( OPT_SERVER = 1000 + iota OPT_DAEMON OPT_SENDER OPT_EXCLUDE OPT_EXCLUDE_FROM OPT_FILTER OPT_COMPARE_DEST OPT_COPY_DEST OPT_LINK_DEST OPT_HELP OPT_INCLUDE OPT_INCLUDE_FROM OPT_MODIFY_WINDOW OPT_MIN_SIZE OPT_CHMOD OPT_READ_BATCH OPT_WRITE_BATCH OPT_ONLY_WRITE_BATCH OPT_MAX_SIZE OPT_NO_D OPT_APPEND OPT_NO_ICONV OPT_INFO OPT_DEBUG OPT_BLOCK_SIZE OPT_USERMAP OPT_GROUPMAP OPT_CHOWN OPT_BWLIMIT OPT_STDERR OPT_OLD_COMPRESS OPT_NEW_COMPRESS OPT_NO_COMPRESS OPT_OLD_ARGS OPT_STOP_AFTER OPT_STOP_AT OPT_REFUSED_BASE = 9000 )
const ( INFO_BACKUP infoLevel = iota INFO_COPY INFO_DEL INFO_FLIST INFO_MISC INFO_MOUNT INFO_NAME INFO_NONREG INFO_PROGRESS INFO_REMOVE INFO_SKIP INFO_STATS INFO_SYMSAFE COUNT_INFO )
const ( DEFAULT_PRIORITY priority = iota HELP_PRIORITY USER_PRIORITY LIMIT_PRIORITY )
const ( W_CLI = 1 << iota W_SRV W_SND W_REC )
const (
POPT_ARGFLAG_OR = 0x08000000
)
const POPT_ARG_MASK = 0x000000FF
const (
POPT_BIT_SET = POPT_ARG_VAL | POPT_ARGFLAG_OR
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type GokrazyOptions ¶
type GokrazyOptions struct { Config string Listen string MonitoringListen string AnonSSHListen string ModuleMap string }
GokrazyOptions contains additional command-line flags, prefixed with gokr. (like --gokr.modulemap) to not clash with rsync flag names.
type Options ¶
type Options struct { Gokrazy GokrazyOptions // contains filtered or unexported fields }
func NewOptions ¶
func NewOptions() *Options
NewOptions returns an Options struct with all options initialized to their default values. Note that ParseArguments will set some options (that default to -1) based on the encountered command-line flags and built-in rules.
func (*Options) AlwaysChecksum ¶
func (*Options) ConnectTimeoutSeconds ¶
func (*Options) DeleteMode ¶
func (*Options) LocalServer ¶
func (*Options) PreserveDevices ¶
func (*Options) PreserveGid ¶
func (*Options) PreserveHardLinks ¶
func (*Options) PreserveLinks ¶
func (*Options) PreserveMTimes ¶
func (*Options) PreservePerms ¶
func (*Options) PreserveSpecials ¶
func (*Options) PreserveUid ¶
func (*Options) SetLocalServer ¶
func (o *Options) SetLocalServer()