diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-04 22:14:16 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-04 22:14:16 +0300 |
| commit | 2381c8712ebafa8060f0d2feacadd85bef280eb0 (patch) | |
| tree | 5132d2b105de91299d052b6a0b69e9b8c9ec7a38 /examples/examples.go | |
| parent | cb9a2b35216a1df783d9a8e9b901bcd32c958dbb (diff) | |
- 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.
Diffstat (limited to 'examples/examples.go')
| -rw-r--r-- | examples/examples.go | 19 |
1 files changed, 19 insertions, 0 deletions
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 +} |
