feat: supply process arguments through native startup
This commit is contained in:
@@ -2,4 +2,25 @@ import "@std/io"
|
||||
|
||||
Init :: struct {
|
||||
io io.Io
|
||||
args Args
|
||||
}
|
||||
|
||||
Args :: struct {
|
||||
values [][*;0]u8
|
||||
}
|
||||
|
||||
argument_count func(args Args) usize {
|
||||
return args.values.len
|
||||
}
|
||||
|
||||
argument func(args Args, index usize) ?[;0]u8 {
|
||||
if index >= argument_count(args) {
|
||||
return null
|
||||
}
|
||||
pointer :: args.values[index]
|
||||
length usize := 0
|
||||
while pointer[length] != 0 {
|
||||
length += 1
|
||||
}
|
||||
return pointer[..length;0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user