Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abhinav/txtar.zig
Simple, readable format for storing multiple files together.
https://github.com/abhinav/txtar.zig
zig zig-library
Last synced: 3 months ago
JSON representation
Simple, readable format for storing multiple files together.
- Host: GitHub
- URL: https://github.com/abhinav/txtar.zig
- Owner: abhinav
- License: bsd-3-clause
- Created: 2023-12-26T12:36:24.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-10T17:04:46.000Z (5 months ago)
- Last Synced: 2024-08-10T18:23:42.764Z (5 months ago)
- Topics: zig, zig-library
- Language: Zig
- Homepage: https://abhinav.github.io/txtar.zig/
- Size: 53.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 🗃️ txtar.zig [![CI](https://github.com/abhinav/txtar.zig/actions/workflows/ci.yml/badge.svg)](https://github.com/abhinav/txtar.zig/actions/workflows/ci.yml) [![codecov](https://codecov.io/github/abhinav/txtar.zig/graph/badge.svg?token=PLIZOORGHS)](https://codecov.io/github/abhinav/txtar.zig)
txtar.zig is a Zig library for interfacing with the [txtar format](#the-txtar-format).
## API reference
Auto-generated API Reference for the library is available at
.Note that Zig's autodoc is currently in beta.
Some links may be broken in the generated website.## Installation
Use `zig fetch --save` to pull a version of the library
into your build.zig.zon.```bash
zig fetch --save "https://github.com/abhinav/txtar.zig/archive/0.5.0.tar.gz"
```Then, import the dependency in your build.zig:
```zig
pub fn build(b: *std.Build) void {
// ...const txtar = b.dependency("txtar", .{
.target = target,
.optimize = optimize,
});
```And add it to the executables that need it:
```zig
const exe = b.addExecutable(.{
// ...
});
exe.addModule("txtar", txtar.module("txtar"));
```Finally, in your code:
```zig
const txtar = @import("txtar");
```These instructions may grow out of date as the Zig package management tooling
and APIs evolve.## The txtar format
txtar is a simple text-based format to store multiple files together.
It looks like this:```
-- foo.txt --
Everything here is part of foo.txt
until the next file header.
-- bar/baz.txt --
Similarly, everything here
is part of bar/baz.txt
until the next header or end of file.
```It's meant to be human-readable and easily diff-able,
making it a good candidate for test case data.See [golang.org/x/tools/txtar](https://pkg.go.dev/golang.org/x/tools/txtar),
which defines the format and provides its Go implementation.## License
This software is made available under the BSD3 license.