You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75-26Lines changed: 75 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,36 +10,85 @@ A NestedText parser written in Zig 0.8 targeting [NestedText v2.0](https://neste
10
10
See my [Zig NestedText Library blog post](https://www.lewisgaul.co.uk/blog/coding/2021/04/18/zig-nestedtext/).
11
11
12
12
13
-
## Building and Usage
13
+
## Usage
14
14
15
-
This library has no external dependencies. The CLI tool depends on `Clap` (included as a git submodule under `deps/`).
15
+
There are a few options for making use of this project:
16
+
- Download from the [releases page](https://github.com/LewisGaul/zig-nestedtext/releases/)
17
+
- Include as a dependency via git submodules
18
+
- Clone and build manually, using a static copy of the built artefacts
19
+
- Use the gyro package manager (untested)
16
20
17
-
Run `zig build` to build the static library `libnestedtext.a` under `zig-cache/lib/`, which can then be linked with your program.
21
+
The Zig library has no external dependencies.
18
22
19
-
This will also create an executable CLI program `nt-cli` under `zig-cache/bin/`. This can be used to convert NestedText to JSON, for example:
23
+
The CLI tool depends only on `Clap` for command line arg parsing (included as a git submodule under `deps/`).
24
+
25
+
Run `zig build` to build the static library `libnestedtext.a` under `zig-out/lib/`, which can then be linked with your program.
26
+
27
+
28
+
### CLI Tool
29
+
30
+
An executable CLI program `nt-cli` is included for exposing the core functionality of the project. When building with `zig build` this can be found under `zig-out/bin/`.
31
+
32
+
This tool can be used to convert between NestedText and JSON, for example:
$./zig-out/bin/nt-cli -f samples/employees.nt | ./zig-out/bin/nt-cli -F json -O nt
50
+
president:
51
+
name: Katheryn McDaniel
52
+
address:
53
+
> 138 Almond Street
54
+
> Topeka, Kansas 20697
55
+
phone:
56
+
cell: 1-210-555-5297
57
+
home: 1-210-555-8470
58
+
email: KateMcD@aol.com
59
+
additional-roles:
60
+
- board member
61
+
vice-president:
62
+
name: Margaret Hodge
63
+
address:
64
+
> 2586 Marigold Lane
65
+
> Topeka, Kansas 20682
66
+
phone: 1-470-555-0398
67
+
email: margaret.hodge@ku.edu
68
+
additional-roles:
69
+
- new membership task force
70
+
- accounting task force
71
+
treasurer:
72
+
-
73
+
name: Fumiko Purvis
74
+
address:
75
+
> 3636 Buffalo Ave
76
+
> Topeka, Kansas 20692
77
+
phone: 1-268-555-0280
78
+
email: fumiko.purvis@hotmail.com
79
+
additional-roles:
80
+
- accounting task force
81
+
-
82
+
name: Merrill Eldridge
83
+
phone: 1-268-555-3602
84
+
email: merrill.eldridge@yahoo.com
85
+
```
86
+
87
+
88
+
## Development
89
+
90
+
Build with `zig build` - the library will be under `zig-out/lib/` and the CLI tool will be under `zig-out/bin/`.
91
+
45
92
Run the tests with `zig build test`.
93
+
94
+
Please feel free to propose changes via a PR, but please make sure all tests are passing, and also make sure to run `zig fmt .` (there are GitHub actions checks for both of these).
0 commit comments