diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-06 09:57:54 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-06 09:57:54 +0300 |
| commit | 72cf1553e87bef43a4d988896d98034ddfbc018c (patch) | |
| tree | af0fc6ff0c4b2c69dcdbb10c655858d6c85cbaec /api/api.go | |
| parent | 4c5b95d5e3811025e2148a6f2a059738e79ca2c9 (diff) | |
move more into API
Diffstat (limited to 'api/api.go')
| -rw-r--r-- | api/api.go | 39 |
1 files changed, 39 insertions, 0 deletions
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...) +} |
