command-not-found: Update with latest commands

This commit is contained in:
Fredrik Fornwall 2017-08-10 01:51:11 +02:00
parent 4f6a97117b
commit d54cef709f
3 changed files with 111 additions and 17 deletions

View File

@ -1,6 +1,6 @@
TERMUX_PKG_HOMEPAGE=https://termux.com
TERMUX_PKG_DESCRIPTION="Suggest installation of packages in interactive shell sessions"
TERMUX_PKG_VERSION=1.23
TERMUX_PKG_VERSION=1.24
termux_step_make_install () {
TERMUX_LIBEXEC_DIR=$TERMUX_PREFIX/libexec/termux

View 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 {

View File

@ -6,6 +6,12 @@ char const* const commands[] = {
" abduco",
"abook",
" abook",
"alpine",
" alpine",
" pico",
" pilot",
" rpdump",
" rpload",
"angband",
" angband",
"apache2",
@ -26,6 +32,10 @@ char const* const commands[] = {
" logresolve",
" rotatelogs",
" suexec",
"apr-dev",
" apr-1-config",
"apr-util-dev",
" apu-1-config",
"apt",
" apt",
" apt-cache",
@ -104,6 +114,8 @@ char const* const commands[] = {
" bzip2recover",
" bzless",
" bzmore",
"cadaver",
" cadaver",
"calcurse",
" calcurse",
" calcurse-caldav",
@ -253,6 +265,7 @@ char const* const commands[] = {
" readtags",
"curl",
" curl",
" curl-config",
"curseofwar",
" curseofwar",
"cvs",
@ -371,7 +384,6 @@ char const* const commands[] = {
" escript",
" run_erl",
" to_erl",
" typer",
"espeak",
" espeak",
"expect",
@ -380,6 +392,8 @@ char const* const commands[] = {
" timed-read",
" timed-run",
" unbuffer",
"fdupes",
" fdupes",
"ffmpeg",
" ffmpeg",
" ffprobe",
@ -424,6 +438,8 @@ char const* const commands[] = {
" fortune",
"fossil",
" fossil",
"freetype-dev",
" freetype-config",
"frobtads",
" frob",
" t3make",
@ -458,7 +474,6 @@ char const* const commands[] = {
" gdk-pixbuf-csource",
" gdk-pixbuf-pixdata",
" gdk-pixbuf-query-loaders",
" gdk-pixbuf-thumbnailer",
"gegl",
" gegl",
" gegl-imgcmp",
@ -573,6 +588,8 @@ char const* const commands[] = {
" gofmt",
"gpgme",
" gpgme-tool",
"gpgme-dev",
" gpgme-config",
"gpgv",
" gpgv",
"graphicsmagick",
@ -772,6 +789,8 @@ char const* const commands[] = {
" sserver",
" uuclient",
" uuserver",
"ldns-dev",
" ldns-config",
"ledger",
" ledger",
"leptonica",
@ -795,6 +814,8 @@ char const* const commands[] = {
"lftp",
" lftp",
" lftpget",
"libassuan-dev",
" libassuan-config",
"libcaca",
" caca-config",
" cacaclock",
@ -831,6 +852,21 @@ char const* const commands[] = {
"libgpg-error",
" gpg-error",
" gpg-error-config",
"libgrpc",
" check_epollexclusive",
" gen_hpack_tables",
" gen_legal_metadata_characters",
" gen_percent_encoding_tables",
" grpc_cpp_plugin",
" grpc_create_jwt",
" grpc_csharp_plugin",
" grpc_node_plugin",
" grpc_objective_c_plugin",
" grpc_php_plugin",
" grpc_print_google_default_creds_token",
" grpc_python_plugin",
" grpc_ruby_plugin",
" grpc_verify_jwt",
"libjasper-utils",
" imgcmp",
" imginfo",
@ -842,6 +878,8 @@ char const* const commands[] = {
" rdjpgcom",
" tjbench",
" wrjpgcom",
"libksba-dev",
" ksba-config",
"libmp3lame",
" lame",
"libnpth",
@ -867,6 +905,9 @@ char const* const commands[] = {
" otr_readforge",
" otr_remac",
" otr_sesskeys",
"libpng-dev",
" libpng-config",
" libpng16-config",
"librsvg",
" rsvg-convert",
"libsndfile",
@ -988,6 +1029,54 @@ char const* const commands[] = {
" mandoc",
" soelim",
" whatis",
"mariadb",
" aria_chk",
" aria_dump_log",
" aria_ftdump",
" aria_pack",
" aria_read_log",
" innochecksum",
" mariadb_config",
" msql2mysql",
" my_print_defaults",
" myisam_ftdump",
" myisamchk",
" myisamlog",
" myisampack",
" mysql",
" mysql_client_test",
" mysql_client_test_embedded",
" mysql_config",
" mysql_convert_table_format",
" mysql_embedded",
" mysql_find_rows",
" mysql_fix_extensions",
" mysql_install_db",
" mysql_plugin",
" mysql_secure_installation",
" mysql_setpermission",
" mysql_tzinfo_to_sql",
" mysql_upgrade",
" mysql_waitpid",
" mysqlaccess",
" mysqladmin",
" mysqlbinlog",
" mysqlcheck",
" mysqld",
" mysqld_multi",
" mysqld_safe",
" mysqld_safe_helper",
" mysqldump",
" mysqldumpslow",
" mysqlhotcopy",
" mysqlimport",
" mysqlshow",
" mysqlslap",
" mytop",
" perror",
" replace",
" resolve_stack_dump",
" resolveip",
"mathomatic",
" mathomatic",
"mc",
@ -1009,6 +1098,8 @@ char const* const commands[] = {
" updatedb",
"moon-buggy",
" moon-buggy",
"moria",
" moria",
"mosh",
" mosh",
" mosh-client",
@ -1448,6 +1539,10 @@ char const* const commands[] = {
"nodejs",
" node",
" npm",
"nodejs-current",
" node",
" npm",
" npx",
"notmuch",
" notmuch",
"ocrad",
@ -1491,8 +1586,9 @@ char const* const commands[] = {
" patch",
"patchelf",
" patchelf",
"pcre-dev",
" pcre-config",
"perl",
" c2ph",
" corelist",
" cpan",
" enc2xs",
@ -1516,7 +1612,6 @@ char const* const commands[] = {
" podchecker",
" podselect",
" prove",
" pstruct",
" ptar",
" ptardiff",
" ptargrep",
@ -1702,7 +1797,6 @@ char const* const commands[] = {
" redis-sentinel",
" redis-server",
"remind",
" cm2rem.tcl",
" rem",
" rem2ps",
" remind",
@ -1724,7 +1818,7 @@ char const* const commands[] = {
" ruby",
"screen",
" screen",
" screen-4.5.1",
" screen-4.6.1",
"scrypt",
" scrypt",
"sed",
@ -1837,14 +1931,6 @@ char const* const commands[] = {
" texi2dvi",
" texi2pdf",
" texindex",
"texlive",
" bibtex",
" lualatex",
" makeindex",
" pdflatex",
" texliveonfly",
" tlmgr",
" xelatex",
"tig",
" tig",
"timewarrior",
@ -2214,6 +2300,7 @@ char const* const commands[] = {
" packages",
" ping",
" ping6",
" pkg",
" pm",
" settings",
" su",