Skip to content

Commit d765fc5

Browse files
committed
aio: fix autocomplete for socket
The checks for -ipv6, -async broke 'socket -commands' Signed-off-by: Steve Bennett <[email protected]>
1 parent 8f88179 commit d765fc5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

jim-aio.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2537,6 +2537,9 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
25372537
int async = 0;
25382538
int flags = 0;
25392539

2540+
if (argc == 2 && Jim_CompareStringImmediate(interp, argv[1], "-commands")) {
2541+
return Jim_CheckShowCommands(interp, argv[1], socktypes);
2542+
}
25402543

25412544
while (argc > 1 && Jim_String(argv[1])[0] == '-') {
25422545
static const char * const options[] = { "-async", "-ipv6", "-noclose", NULL };
@@ -2571,12 +2574,14 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
25712574

25722575
if (argc < 2) {
25732576
wrongargs:
2574-
Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? type ?address?");
2577+
Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? socktype ?address?");
25752578
return JIM_ERR;
25762579
}
25772580

2578-
if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socket type", JIM_ERRMSG) != JIM_OK)
2579-
return Jim_CheckShowCommands(interp, argv[1], socktypes);
2581+
if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socktype", JIM_ERRMSG) != JIM_OK) {
2582+
/* No need to check for -commands here since we did it above */
2583+
return JIM_ERR;
2584+
}
25802585

25812586
Jim_SetEmptyResult(interp);
25822587

0 commit comments

Comments
 (0)