sorairolake / sysexits-zig

The system exit codes as defined by <sysexits.h> for Zig

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sysexits-zig

CI

sysexits-zig is a library that provides the system exit code constants as defined by <sysexits.h>.

This library is a port of sysexits-rs.

Usage

Example

const std = @import("std");

const sysexits = @import("sysexits");

pub fn main() !u8 {
    const bytes = [_]u8{ 0xf0, 0x9f, 0x92, 0x96 };
    if (std.unicode.utf8ValidateSlice(&bytes)) {
        try std.io.getStdOut().writer().print("{s}\n", .{bytes});
        return @intFromEnum(sysexits.ExitCode.ok);
    } else {
        try std.io.getStdErr().writer().print("Error: invalid UTF-8 sequence\n", .{});
        return @intFromEnum(sysexits.ExitCode.data_err);
    }
}

Documentation

To build the documentation:

zig build doc

The result is generated in zig-out/docs.

If you want to preview this, run a HTTP server locally. For example:

python -m http.server -d zig-out/docs

Then open http://localhost:8000/ in your browser.

Zig version

This library is compatible with Zig version 0.12.0.

Changelog

Please see CHANGELOG.adoc.

Contributing

Please see CONTRIBUTING.adoc.

License

Copyright © 2023–2024 Shun Sakai (see AUTHORS.adoc)

This library is distributed under the terms of either the Apache License 2.0 or the MIT License.

This project is compliant with version 3.0 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.

About

The system exit codes as defined by <sysexits.h> for Zig

License:Other


Languages

Language:Zig 94.3%Language:Just 5.7%