summaryrefslogtreecommitdiff
path: root/api/options
diff options
context:
space:
mode:
Diffstat (limited to 'api/options')
-rw-r--r--api/options/option.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/api/options/option.go b/api/options/option.go
index fcffccd..1d9b931 100644
--- a/api/options/option.go
+++ b/api/options/option.go
@@ -21,6 +21,7 @@ type (
FileModed interface{ SetFileMode(os.FileMode) }
Prunable interface{ SetPrune() }
Absentable interface{ SetAbsent() }
+ Latestable interface{ SetLatest() }
Linkable interface {
SetSymlink(target string)
SetHardlink(target string)
@@ -117,6 +118,17 @@ var IsAbsent = func(t any) {
func IsAbsentFunc() Option { return IsAbsent }
+// IsLatest marks the package resource to be updated to the latest version.
+var IsLatest = func(t any) {
+ r, ok := t.(Latestable)
+ if !ok {
+ log.Fatalf("%T does not support IsLatest", t)
+ }
+ r.SetLatest()
+}
+
+func IsLatestFunc() Option { return IsLatest }
+
// WithSymlink makes the resource a symbolic link pointing at target.
func WithSymlink(target string) Option {
return func(t any) {