aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
author2026-02-16 21:37:31 +0300
committer2026-02-17 20:13:24 +0300
commitd3fd3ba6f9796df96ec4eae9124a460fbb05eb59 (patch)
tree57803d91f8ae7bd3085b0b393bdf81bcc2ac0dfa /example
downloadconf-d3fd3ba6f9796df96ec4eae9124a460fbb05eb59.tar.gz
conf-d3fd3ba6f9796df96ec4eae9124a460fbb05eb59.tar.bz2
conf-d3fd3ba6f9796df96ec4eae9124a460fbb05eb59.tar.xz
conf-d3fd3ba6f9796df96ec4eae9124a460fbb05eb59.zip
init
Diffstat (limited to 'example')
-rw-r--r--example/file.conf33
-rw-r--r--example/main.go16
2 files changed, 49 insertions, 0 deletions
diff --git a/example/file.conf b/example/file.conf
new file mode 100644
index 0000000..d23c7d7
--- /dev/null
+++ b/example/file.conf
@@ -0,0 +1,33 @@
+# one line comment
+
+simpe_key = "тест_кириллицы";
+simple_key_without_spaces = value;
+
+string_key =
+ "value"
+ 'string';
+
+multiline_string = `
+ multiline
+ string
+ 123
+`;
+
+int_key = -123.456;
+bool_key = true;
+
+expression1 argument1 "argument2" 123;
+
+# comment can be everywhere
+group_directive_without_arguments {
+ expression1 argument2 "string" 123 true;
+ expression2 argument3 "string111" 123321 false;
+ children_group "some argument" {
+ # child group. Can be empty. This is equivalent to directive `children_group "some argument"`
+ }
+}
+
+group_directive_with_argument "some other argument" 'second argument' {
+ child_val = "children value";
+}
+
diff --git a/example/main.go b/example/main.go
new file mode 100644
index 0000000..6e0c8b8
--- /dev/null
+++ b/example/main.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "fmt"
+
+ "go.neonxp.ru/conf"
+)
+
+func main() {
+ out, err := conf.LoadFile("./file.conf")
+ if err != nil {
+ panic(err)
+ }
+
+ fmt.Println(out)
+}