From d765fc5bfd0643d4af928e538715beb32c2111db Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 22 Jun 2023 17:11:51 +1000 Subject: aio: fix autocomplete for socket The checks for -ipv6, -async broke 'socket -commands' Signed-off-by: Steve Bennett --- jim-aio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jim-aio.c b/jim-aio.c index e3d0e96..093457f 100644 --- a/jim-aio.c +++ b/jim-aio.c @@ -2537,6 +2537,9 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv) int async = 0; int flags = 0; + if (argc == 2 && Jim_CompareStringImmediate(interp, argv[1], "-commands")) { + return Jim_CheckShowCommands(interp, argv[1], socktypes); + } while (argc > 1 && Jim_String(argv[1])[0] == '-') { 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) if (argc < 2) { wrongargs: - Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? type ?address?"); + Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? socktype ?address?"); return JIM_ERR; } - if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socket type", JIM_ERRMSG) != JIM_OK) - return Jim_CheckShowCommands(interp, argv[1], socktypes); + if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socktype", JIM_ERRMSG) != JIM_OK) { + /* No need to check for -commands here since we did it above */ + return JIM_ERR; + } Jim_SetEmptyResult(interp); -- cgit v1.1