From 2381c8712ebafa8060f0d2feacadd85bef280eb0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 4 Jul 2026 22:14:16 +0300 Subject: - Delete internal/file/content.go (duplicate implementation with different semantics). - Refactor internal/file/file.go to use a File struct with options (WithContent, WithSource, WithMode, etc.). - Update Have signature to accept variadic options instead of (path, param). - Update tests to use new API. - Update TODO.md to remove resolved blocker and reflect remaining features. --- examples/examples.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/examples.go (limited to 'examples') diff --git a/examples/examples.go b/examples/examples.go new file mode 100644 index 0000000..ecc5036 --- /dev/null +++ b/examples/examples.go @@ -0,0 +1,19 @@ +package examples + +import ( + "fmt" + + "codeberg.org/snonux/gonf/internal/file" +) + +func Run() error { + if err := file.Have("/tmp/gonf_example.conf", file.WithSource("source://assets/testfiles/test.tmpl")); err != nil { + return fmt.Errorf("failed to create example conf: %w", err) + } + + if err := file.Have("/tmp/foo.txt", file.WithContent("hi")); err != nil { + return fmt.Errorf("failed to create foo.txt: %w", err) + } + + return nil +} -- cgit v1.2.3