Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svelterust/utils
Nice helper functions for build.zig
https://github.com/svelterust/utils
utils zig
Last synced: 3 months ago
JSON representation
Nice helper functions for build.zig
- Host: GitHub
- URL: https://github.com/svelterust/utils
- Owner: svelterust
- Created: 2022-06-12T17:19:50.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T14:20:20.000Z (over 2 years ago)
- Last Synced: 2024-10-24T16:50:21.463Z (3 months ago)
- Topics: utils, zig
- Language: Zig
- Homepage:
- Size: 4.88 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# utils
Collection of useful functions for `build.zig`.
Examples are listed in the source code.## Getting started
```bash
curl https://raw.githubusercontent.com/knarkzel/utils/master/src/main.zig -o utils.zig
```## Documentation
```zig
pub const Options = struct {
enable_stdout: bool = false,
enable_stderr: bool = false,
};/// Looks for build.zig by traversing from current directory and upwards,
/// ideal for setting builder.build_root starting from builder.build_root
pub fn root(cwd: []const u8) UtilsError![]const u8/// Run shell command
pub fn exec(allocator: std.mem.Allocator, cwd: []const u8, argv: []const []const u8, opts: Options) !void/// Ensure repository exists, if not clone it with git. cwd is absolute path
pub fn ensure_repository(allocator: std.mem.Allocator, cwd: []const u8, path: []const u8, url: []const u8) !void/// Ensure submodules are initialized. cwd is absolute path
pub fn ensure_submodules(allocator: std.mem.Allocator, cwd: []const u8) !void/// Ensure zigmod has done initial fetch. cwd is absolute path
pub fn ensure_zigmod(allocator: std.mem.Allocator, cwd: []const u8) !void/// Ensure file exists, otherwise wget it. cwd is absolute path
pub fn ensure_file(allocator: std.mem.Allocator, cwd: []const u8, path: []const u8, url: []const u8) !void/// Ensure path exists, otherwise wget and extract it with tar. cwd is absolute path
pub fn ensure_tar(allocator: std.mem.Allocator, cwd: []const u8, path: []const u8, url: []const u8) !void
```