summaryrefslogtreecommitdiff
path: root/clap/args.zig
diff options
context:
space:
mode:
Diffstat (limited to 'clap/args.zig')
-rw-r--r--clap/args.zig12
1 files changed, 10 insertions, 2 deletions
diff --git a/clap/args.zig b/clap/args.zig
index 4234ada..b699438 100644
--- a/clap/args.zig
+++ b/clap/args.zig
@@ -50,11 +50,19 @@ pub const OsIterator = struct {
50 arena: heap.ArenaAllocator, 50 arena: heap.ArenaAllocator,
51 args: process.ArgIterator, 51 args: process.ArgIterator,
52 52
53 pub fn init(allocator: *mem.Allocator) OsIterator { 53 /// The executable path (this is the first argument passed to the program)
54 return OsIterator{ 54 /// TODO: Is it the right choice for this to be null? Maybe `init` should
55 /// return an error when we have no exe.
56 exe_arg: ?[]const u8,
57
58 pub fn init(allocator: *mem.Allocator) Error!OsIterator {
59 var res = OsIterator{
55 .arena = heap.ArenaAllocator.init(allocator), 60 .arena = heap.ArenaAllocator.init(allocator),
56 .args = process.args(), 61 .args = process.args(),
62 .exe_arg = undefined,
57 }; 63 };
64 res.exe_arg = try res.next();
65 return res;
58 } 66 }
59 67
60 pub fn deinit(iter: *OsIterator) void { 68 pub fn deinit(iter: *OsIterator) void {