Compare commits
No commits in common. "f8018854be96a0bad19224e44235cc1160b21e65" and "1bb3659df6c076d76187cc557a8aed1fc2df6b9e" have entirely different histories.
f8018854be
...
1bb3659df6
|
@ -1 +1 @@
|
|||
Subproject commit 47b8ab43f3cf8362b266613e55704c8ae38e9bc6
|
||||
Subproject commit 021b71dde4774364b9da2418e3de2c42499c605d
|
|
@ -1 +1 @@
|
|||
Subproject commit ac5f46541ca47d3db9df0fcef3cc61731adaefab
|
||||
Subproject commit a2af4a9267c547ec0f91ea1a84b2a50760ca5483
|
29
src/main.zig
29
src/main.zig
|
@ -32,25 +32,26 @@ pub fn main() anyerror!void {
|
|||
const alloc = gpa.allocator();
|
||||
defer std.debug.assert(!gpa.deinit());
|
||||
|
||||
// CLI Arguments
|
||||
const params = comptime clap.parseParamsComptime(
|
||||
\\-h, --help Display this help and exit.
|
||||
\\-b, --bios <str> Optional path to a GBA BIOS ROM.
|
||||
\\<str> Path to the GBA GamePak ROM
|
||||
\\
|
||||
);
|
||||
// Parse CLI Arguments
|
||||
const params = comptime [_]clap.Param(clap.Help){
|
||||
clap.parseParam("-h, --help Display this help and exit. ") catch unreachable,
|
||||
clap.parseParam("-b, --bios <PATH> Optional Path to GBA BIOS ROM. ") catch unreachable,
|
||||
clap.parseParam("<PATH> Path to GBA GamePak ROM ") catch unreachable,
|
||||
};
|
||||
|
||||
var res = try clap.parse(clap.Help, ¶ms, clap.parsers.default, .{});
|
||||
defer res.deinit();
|
||||
var args = try clap.parse(clap.Help, ¶ms, .{});
|
||||
defer args.deinit();
|
||||
|
||||
if (args.flag("--help")) return clap.help(std.io.getStdErr().writer(), ¶ms);
|
||||
|
||||
const bios_path: ?[]const u8 = if (args.option("--bios")) |p| p else null;
|
||||
|
||||
const positionals = args.positionals();
|
||||
const stderr = std.io.getStdErr();
|
||||
defer stderr.close();
|
||||
|
||||
if (res.args.help) return clap.help(stderr.writer(), clap.Help, ¶ms, .{});
|
||||
const bios_path: ?[]const u8 = if (res.args.bios) |p| p else null;
|
||||
|
||||
const rom_path = switch (res.positionals.len) {
|
||||
1 => res.positionals[0],
|
||||
const rom_path = switch (positionals.len) {
|
||||
1 => positionals[0],
|
||||
0 => {
|
||||
try stderr.writeAll("ZBA requires a positional path to a GamePak ROM.\n");
|
||||
return CliError.InsufficientOptions;
|
||||
|
|
Loading…
Reference in New Issue