瀏覽代碼

Completion without arg returns NOTFOUND

Serj Kalichev 1 年之前
父節點
當前提交
11817c92fd
共有 1 個文件被更改,包括 10 次插入8 次删除
  1. 10 8
      klish/ksession/ksession_parse.c

+ 10 - 8
klish/ksession/ksession_parse.c

@@ -122,14 +122,12 @@ static kpargv_status_e ksession_parse_arg(ksession_t *session,
 				// That's time to add entry to completions list.
 				if (!kpargv_continuable(pargv))
 					kpargv_add_completions(pargv, entry);
-				return KPARSE_INCOMPLETED;
-			} else {
-				// Add entry to completions if it's last incompleted arg.
-				if (faux_argv_is_last(*argv_iter) &&
-					kpargv_continuable(pargv)) {
-					kpargv_add_completions(pargv, entry);
-					return KPARSE_NOTFOUND;
-				}
+				return KPARSE_NOTFOUND;
+			// Add entry to completions if it's last incompleted arg.
+			} else if (faux_argv_is_last(*argv_iter) &&
+				kpargv_continuable(pargv)) {
+				kpargv_add_completions(pargv, entry);
+				return KPARSE_NOTFOUND;
 			}
 		}
 
@@ -239,6 +237,10 @@ fprintf(stderr, "%s: %s\n", kentry_name(nested), kpargv_status_decode(nrc));
 				rc = nrc;
 				break;
 			}
+			if ((min > 0) && (KPARSE_INCOMPLETED == nrc)) {
+				rc = nrc;
+				break;
+			}
 			// Not found necessary number of mandatory instances
 			if (num < min) {
 				if (KPARSE_INPROGRESS == nrc)