From 72cf1553e87bef43a4d988896d98034ddfbc018c Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 6 Jul 2026 09:57:54 +0300 Subject: move more into API --- api/api.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 api/api.go (limited to 'api/api.go') diff --git a/api/api.go b/api/api.go new file mode 100644 index 0000000..d82c2c8 --- /dev/null +++ b/api/api.go @@ -0,0 +1,39 @@ +package api + +import ( + "codeberg.org/snonux/gonf/api/option" + "codeberg.org/snonux/gonf/internal/resource" + "codeberg.org/snonux/gonf/internal/resource/dir" + "codeberg.org/snonux/gonf/internal/resource/file" + "codeberg.org/snonux/gonf/internal/resource/link" +) + +// File creates a file resource. +func File(path string, opts ...option.Option) resource.Resource { + return file.Have(path, opts...) +} + +// NoFile creates a file resource that is ensured to be absent. +func NoFile(path string, opts ...option.Option) resource.Resource { + return file.Absent(path, opts...) +} + +// Dir creates a directory resource. +func Dir(path string, opts ...option.Option) resource.Resource { + return dir.Have(path, opts...) +} + +// NoDir creates a directory resource that is ensured to be absent. +func NoDir(path string, opts ...option.Option) resource.Resource { + return dir.Absent(path, opts...) +} + +// Link creates a link resource (symbolic or hard). +func Link(path string, opts ...option.Option) resource.Resource { + return link.Have(path, opts...) +} + +// NoLink creates a link resource that is ensured to be absent. +func NoLink(path string, opts ...option.Option) resource.Resource { + return link.Absent(path, opts...) +} -- cgit v1.2.3