summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/api.go4
-rw-r--r--api/options/option.go28
2 files changed, 18 insertions, 14 deletions
diff --git a/api/api.go b/api/api.go
index ea30363..6e25151 100644
--- a/api/api.go
+++ b/api/api.go
@@ -36,3 +36,7 @@ func Link(path string, opts ...options.Option) Resource {
func NoLink(path string, opts ...options.Option) Resource {
return link.Absent(path, opts...)
}
+
+// func Package(name string, ...options.Options) Resource {
+// return pkg.Present(name, opts...)
+// }
diff --git a/api/options/option.go b/api/options/option.go
index 1c757c4..fcffccd 100644
--- a/api/options/option.go
+++ b/api/options/option.go
@@ -96,27 +96,27 @@ func WithFileMode(mode os.FileMode) Option {
// WithPrune enables reconciliation of extra destination entries during a
// source copy, and recursive removal during IsAbsent().
-func WithPrune() Option {
- return func(t any) {
- r, ok := t.(Prunable)
- if !ok {
- log.Fatalf("%T does not support WithPrune", t)
- }
- r.SetPrune()
+var WithPrune = func(t any) {
+ r, ok := t.(Prunable)
+ if !ok {
+ log.Fatalf("%T does not support WithPrune", t)
}
+ r.SetPrune()
}
+func WithPruneFunc() Option { return WithPrune }
+
// IsAbsent marks the resource for removal.
-func IsAbsent() Option {
- return func(t any) {
- r, ok := t.(Absentable)
- if !ok {
- log.Fatalf("%T does not support IsAbsent", t)
- }
- r.SetAbsent()
+var IsAbsent = func(t any) {
+ r, ok := t.(Absentable)
+ if !ok {
+ log.Fatalf("%T does not support IsAbsent", t)
}
+ r.SetAbsent()
}
+func IsAbsentFunc() Option { return IsAbsent }
+
// WithSymlink makes the resource a symbolic link pointing at target.
func WithSymlink(target string) Option {
return func(t any) {