Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
reactivate the ability to only type a part of the sub-command
Baptiste Daroussin committed 15 years ago
commit 6078b9eec36f139f71414bd33c8e47c7a4bc8dae
parent 1065b55
1 file changed +8 -2
modified pkg/main.c
@@ -136,11 +136,17 @@ main(int argc, char **argv)
		return (command->exec(argc, argv));
	}

-
	if (ambiguous >= 1) {
+
	if (ambiguous == 1 ) {
+
		argc--;
+
		argv++;
+
		assert(command->exex != NULL);
+
		return (command->exec(argc, argv));
+
	}
+
	if (ambiguous > 1) {
		warnx("'%s' is not a valid command.\n", argv[1]);

		fprintf(stderr, "See 'pkg help' for more information on the commands.\n\n");
-
		fprintf(stderr, "Command '%s' could be %s:\n", argv[1], ( ambiguous == 1 ? "this" : "one of the following"));
+
		fprintf(stderr, "Command '%s' could be one of the following:\n", argv[1]);

		for (i = 0; i < cmd_len; i++)
			if (strncmp(argv[1], cmd[i].name, len) == 0)