summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md25
1 files changed, 18 insertions, 7 deletions
diff --git a/README.md b/README.md
index 29264c2..67dbb17 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,26 @@
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
common config file handling for protobuf defined config files
+intended to be super simple so the code you need to write is simple.
-By default, the config files are stored as:
+Enables Load functions:
-~/.config/<argname>/<protoname>.text
+// loads ~/.config/myapp/trees.text
+cfg := new(MyPB)
+err := config.ConfigLoad(cfg, "myapp", "trees")
-assumes config files are simple, intended to be edited by hand
-by the user and can be exported by protobuf FormatTEXT()
+Enables Save functions:
-intended to be called by functions that are automatically
-generated by 'autogenpb' for protobuf defined config files.
+err := cfg.Save() // it automatically knows where to save
-If you aren't using .proto defined config files, this package is not for you
+### Errors ####
+
+if errors.Is(err, config.VersionMismatch) {
+ // protobuf structure changed
+}
+if errors.Is(err, config.ErrEmpty) {
+ // config file was empty
+}
+if errors.Is(err, config.ErrNotExist) {
+ // config file didn't exist (yes, this is the os.ExistErr)
+}