Skip to content

Commit

Permalink
Merge pull request #23 from der-teufel-programming/update-to-0.11
Browse files Browse the repository at this point in the history
Update to zig 0.11.0
  • Loading branch information
shtanton authored Sep 16, 2023
2 parents d173fec + 09362c6 commit 519c859
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: goto-bus-stop/setup-zig@v1
with:
version: 0.10.1
version: 0.11.0
- run: zig fmt --check src/*.zig
- run: zig build
- run: mv tests/test.sh . && ./test.sh
17 changes: 10 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ const Builder = @import("std").build.Builder;

pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const optimize = b.standardOptimizeOption(.{});

const strip = b.option(bool, "strip", "Set to true to strip binary") orelse false;

const exe = b.addExecutable("gmi2html", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
const exe = b.addExecutable(.{
.name = "gmi2html",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
.single_threaded = true,
});
exe.strip = strip;
exe.single_threaded = true;
exe.install();
b.installArtifact(exe);

const run_cmd = exe.run();
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
Expand Down
4 changes: 2 additions & 2 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn trimLeft(str: []const u8) []const u8 {
}

fn isWebUrl(url: []const u8) bool {
const scheme = for (url) |char, i| {
const scheme = for (url, 0..) |char, i| {
if (char == ':') {
break url[0..i];
} else if (char == '/') {
Expand Down Expand Up @@ -198,7 +198,7 @@ pub fn main() anyerror!u8 {
defer arena.deinit();
const allocator = arena.allocator();

var args = std.process.args();
var args = try std.process.argsWithAllocator(allocator);
defer args.deinit();
_ = args.skip();
var state = State{};
Expand Down

0 comments on commit 519c859

Please sign in to comment.