lib: remove cutPrefix implementation

We can use std.mem.cutPrefix directly now that we're on Zig 0.16.
This commit is contained in:
Jon Parise
2026-08-05 23:07:43 -04:00
parent 8eecb8fdbf
commit 1d6bc68298
4 changed files with 5 additions and 23 deletions

View File

@@ -5,7 +5,6 @@ const Action = @import("../cli.zig").ghostty.Action;
const apprt = @import("../apprt.zig");
const args = @import("args.zig");
const diagnostics = @import("diagnostics.zig");
const lib = @import("../lib/main.zig");
const homedir = @import("../os/homedir.zig");
const global = @import("../global.zig");
@@ -70,12 +69,12 @@ pub const Options = struct {
Allocator.Error;
fn checkArg(self: *Options, alloc: Allocator, arg: []const u8) CheckArgError!?[:0]const u8 {
if (lib.cutPrefix(u8, arg, "--class=")) |rest| {
if (std.mem.cutPrefix(u8, arg, "--class=")) |rest| {
self.class = try alloc.dupeZ(u8, std.mem.trim(u8, rest, &std.ascii.whitespace));
return null;
}
if (lib.cutPrefix(u8, arg, "--working-directory=")) |rest| {
if (std.mem.cutPrefix(u8, arg, "--working-directory=")) |rest| {
const stripped = std.mem.trim(u8, rest, &std.ascii.whitespace);
if (std.mem.eql(u8, stripped, "home")) return try alloc.dupeZ(u8, arg);
if (std.mem.eql(u8, stripped, "inherit")) return try alloc.dupeZ(u8, arg);