sqlite: Update from 3.19.3 to 3.20.0
[termux-packages] / packages / command-not-found / command-not-found.c
index b959084..23b2399 100644 (file)
@@ -42,8 +42,13 @@ int main(int argc, char** argv) {
                        char const* binary_name = current_line + 1;
                        int distance = termux_levenshtein_distance(command_not_found, binary_name);
                        if (distance == 0 && strcmp(command_not_found, binary_name) == 0) {
-                               printf("The program '%s' is not installed. Install it by executing:\n pkg install %s\n", binary_name, current_package);
-                               return 127;
+                               if (best_distance == 0) {
+                                       printf("or\n");
+                               } else {
+                                       printf("The program '%s' is not installed. Install it by executing:\n", binary_name);
+                               }
+                               printf(" pkg install %s\n", current_package);
+                               best_distance = 0;
                        } else if (best_distance == distance) {
                                guesses_at_best_distance++;
                        } else if (best_distance == -1 || best_distance > distance) {
@@ -57,6 +62,8 @@ int main(int argc, char** argv) {
                }
        }
 
+       if (best_distance == 0) return 127;
+
        if (best_distance == -1 || best_distance > 3) {
                printf("%s: command not found\n", command_not_found);
        } else {