clean up command line arguments & help in converters

This commit is contained in:
Ryan Fleury
2024-02-26 16:49:57 -08:00
parent 3b7a4f3331
commit 70d004e5d3
4 changed files with 110 additions and 8 deletions
+23 -4
View File
@@ -52,15 +52,34 @@ entry_point(CmdLine *cmdline)
{
//- rjf: initialize state, unpack command line
Arena *arena = arena_alloc();
B32 do_help = (cmd_line_has_flag(cmdline, str8_lit("help")) ||
cmd_line_has_flag(cmdline, str8_lit("h")) ||
cmd_line_has_flag(cmdline, str8_lit("?")));
P2R_User2Convert *user2convert = p2r_user2convert_from_cmdln(arena, cmdline);
//- rjf: display errors with input
if(user2convert->errors.node_count > 0)
//- rjf: display help
if(do_help || user2convert->errors.node_count != 0)
{
for(String8Node *n = user2convert->errors.first; n != 0; n = n->next)
fprintf(stderr, "--- raddbgi_from_pdb ----------------------------------------------------------\n\n");
fprintf(stderr, "This utility converts debug information from PDBs into the RAD Debug Info.\n");
fprintf(stderr, "format. The following arguments are accepted:\n\n");
fprintf(stderr, "--exe:<path> [optional] Specifies the path of the executable file for which the\n");
fprintf(stderr, " debug info was generated.\n");
fprintf(stderr, "--pdb:<path> Specifies the path of the PDB debug info file to\n");
fprintf(stderr, " convert.\n");
fprintf(stderr, "--out:<path> Specifies the path at which the output Breakpad debug\n");
fprintf(stderr, " info will be written.\n\n");
if(!do_help)
{
fprintf(stderr, "error(input): %.*s\n", str8_varg(n->string));
for(String8Node *n = user2convert->errors.first; n != 0; n = n->next)
{
fprintf(stderr, "error(input): %.*s\n", str8_varg(n->string));
}
}
os_exit_process(0);
}
//- rjf: convert