Skip to content

Commit 1f41b6d

Browse files
committed
Fix getopt parsing for -i, -dr and -Rq
1 parent adf8189 commit 1f41b6d

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ int main(int argc, const char **argv) {
113113
r2ai_init (&cps);
114114

115115
RGetopt opt;
116-
r_getopt_init (&opt, argc, argv, "vhp:m:q:Eb:Kc:f:ie:w");
116+
r_getopt_init (&opt, argc, argv, "vhp:m:q:Eb:Kc:f:i:e:w");
117117
while ((c = r_getopt_next (&opt)) != -1) {
118118
switch (c) {
119119
case 'p':

src/r2ai.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,10 @@ R_API void cmd_r2ai(RCorePluginSession *cps, const char *input) {
385385
cmd_r2ai_lr (cps);
386386
} else if (r_str_startswith (input, "-L")) {
387387
cmd_r2ai_logs (cps);
388+
} else if (r_str_startswith (input, "-dr")) {
389+
cmd_r2ai_d (cps, r_str_trim_head_ro (input + 3), true);
388390
} else if (r_str_startswith (input, "-d")) {
389391
cmd_r2ai_d (cps, r_str_trim_head_ro (input + 2), false);
390-
} else if (r_str_startswith (input, "-dr")) {
391-
cmd_r2ai_d (cps, r_str_trim_head_ro (input + 2), true);
392392
} else if (r_str_startswith (input, "-S")) {
393393
if (state->db == NULL) {
394394
state->db = r_vdb_new (R2AI_DEFAULT_VECTORS);
@@ -411,6 +411,8 @@ R_API void cmd_r2ai(RCorePluginSession *cps, const char *input) {
411411
cmd_r2ai_i (cps, r_str_trim_head_ro (input + 2));
412412
} else if (r_str_startswith (input, "-r")) {
413413
cmd_r2ai_repl (cps);
414+
} else if (r_str_startswith (input, "-Rq")) {
415+
cmd_r2ai_R (cps, r_str_trim_head_ro (input + 3));
414416
} else if (r_str_startswith (input, "-R")) {
415417
RList *messages = r2ai_conversation_get (state);
416418
if (!messages || r_list_empty (messages)) {
@@ -419,8 +421,6 @@ R_API void cmd_r2ai(RCorePluginSession *cps, const char *input) {
419421
r2ai_msgs_clear (messages);
420422
r_cons_printf (core->cons, "Chat conversation context has been reset\n");
421423
}
422-
} else if (r_str_startswith (input, "-Rq")) {
423-
cmd_r2ai_R (cps, r_str_trim_head_ro (input + 3));
424424
} else if (r_str_startswith (input, "-m")) {
425425
cmd_r2ai_m (cps, r_str_trim_head_ro (input + 2));
426426
} else if (r_str_startswith (input, "-p")) {

0 commit comments

Comments
 (0)