mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
link: Add --expire and --unlink flags
This adds expire and unlink fields to the PublicLink interface. This fixes up the affected backends and removes unlink parameters where they are present.
This commit is contained in:
committed by
Nick Craig-Wood
parent
fb61ed8506
commit
55ad1354b6
@@ -7,8 +7,11 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
)
|
||||
|
||||
// Params is the input and output type for the Func
|
||||
@@ -212,3 +215,16 @@ func (p Params) GetStructMissingOK(key string, out interface{}) error {
|
||||
}
|
||||
return p.GetStruct(key, out)
|
||||
}
|
||||
|
||||
// GetDuration get the duration parameters from in
|
||||
func (p Params) GetDuration(key string) (time.Duration, error) {
|
||||
s, err := p.GetString(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
duration, err := fs.ParseDuration(s)
|
||||
if err != nil {
|
||||
return 0, ErrParamInvalid{errors.Wrap(err, "parse duration")}
|
||||
}
|
||||
return duration, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user