filter: rename Opt to Options for consistency

This commit is contained in:
Nick Craig-Wood 2024-07-04 11:30:04 +01:00
parent ce1859cd82
commit 25c6379688
2 changed files with 7 additions and 7 deletions

View File

@ -566,7 +566,7 @@ func (f *Fs) InternalTestAgeQuery(t *testing.T) {
// Check set up for filtering // Check set up for filtering
assert.True(t, f.Features().FilterAware) assert.True(t, f.Features().FilterAware)
opt := &filter.Opt{} opt := &filter.Options{}
err := opt.MaxAge.Set("1h") err := opt.MaxAge.Set("1h")
assert.NoError(t, err) assert.NoError(t, err)
flt, err := filter.NewFilter(opt) flt, err := filter.NewFilter(opt)

View File

@ -19,8 +19,8 @@ import (
// This is accessed through GetConfig and AddConfig // This is accessed through GetConfig and AddConfig
var globalConfig = mustNewFilter(nil) var globalConfig = mustNewFilter(nil)
// Opt configures the filter // Options configures the filter
type Opt struct { type Options struct {
DeleteExcluded bool DeleteExcluded bool
RulesOpt // embedded so we don't change the JSON API RulesOpt // embedded so we don't change the JSON API
ExcludeFile []string ExcludeFile []string
@ -35,7 +35,7 @@ type Opt struct {
} }
// DefaultOpt is the default config for the filter // DefaultOpt is the default config for the filter
var DefaultOpt = Opt{ var DefaultOpt = Options{
MinAge: fs.DurationOff, MinAge: fs.DurationOff,
MaxAge: fs.DurationOff, MaxAge: fs.DurationOff,
MinSize: fs.SizeSuffix(-1), MinSize: fs.SizeSuffix(-1),
@ -47,7 +47,7 @@ type FilesMap map[string]struct{}
// Filter describes any filtering in operation // Filter describes any filtering in operation
type Filter struct { type Filter struct {
Opt Opt Opt Options
ModTimeFrom time.Time ModTimeFrom time.Time
ModTimeTo time.Time ModTimeTo time.Time
fileRules rules fileRules rules
@ -59,7 +59,7 @@ type Filter struct {
// NewFilter parses the command line options and creates a Filter // NewFilter parses the command line options and creates a Filter
// object. If opt is nil, then DefaultOpt will be used // object. If opt is nil, then DefaultOpt will be used
func NewFilter(opt *Opt) (f *Filter, err error) { func NewFilter(opt *Options) (f *Filter, err error) {
f = &Filter{} f = &Filter{}
// Make a copy of the options // Make a copy of the options
@ -130,7 +130,7 @@ func NewFilter(opt *Opt) (f *Filter, err error) {
return f, nil return f, nil
} }
func mustNewFilter(opt *Opt) *Filter { func mustNewFilter(opt *Options) *Filter {
f, err := NewFilter(opt) f, err := NewFilter(opt)
if err != nil { if err != nil {
panic(err) panic(err)