mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
fs: make display of default values of --min-age/--max-age be off - Fixes #2121
This commit is contained in:
@@ -92,12 +92,10 @@ type Opt struct {
|
||||
MaxSize fs.SizeSuffix
|
||||
}
|
||||
|
||||
const unusedAge = fs.Duration((1 << 63) - 1)
|
||||
|
||||
// DefaultOpt is the default config for the filter
|
||||
var DefaultOpt = Opt{
|
||||
MinAge: unusedAge,
|
||||
MaxAge: unusedAge,
|
||||
MinAge: fs.DurationOff,
|
||||
MaxAge: fs.DurationOff,
|
||||
MinSize: fs.SizeSuffix(-1),
|
||||
MaxSize: fs.SizeSuffix(-1),
|
||||
}
|
||||
@@ -126,11 +124,11 @@ func NewFilter(opt *Opt) (f *Filter, err error) {
|
||||
}
|
||||
|
||||
// Filter flags
|
||||
if f.Opt.MinAge != unusedAge {
|
||||
if f.Opt.MinAge.IsSet() {
|
||||
f.ModTimeTo = time.Now().Add(-time.Duration(f.Opt.MinAge))
|
||||
fs.Debugf(nil, "--min-age %v to %v", f.Opt.MinAge, f.ModTimeTo)
|
||||
}
|
||||
if f.Opt.MaxAge != unusedAge {
|
||||
if f.Opt.MaxAge.IsSet() {
|
||||
f.ModTimeFrom = time.Now().Add(-time.Duration(f.Opt.MaxAge))
|
||||
if !f.ModTimeTo.IsZero() && f.ModTimeFrom.Before(f.ModTimeTo) {
|
||||
log.Fatal("filter: --min-age can't be larger than --max-age")
|
||||
|
||||
Reference in New Issue
Block a user