From 9023bf0ac3eb73ebad8fb333c0b08a0a09332659 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Thu, 16 Apr 2020 13:02:50 +1000 Subject: [PATCH] package: add package names as an alias for package list Use the same name for this subcommand as Tcl. For now we keep the existing package list in case it is in use. Signed-off-by: Steve Bennett --- jim-package.c | 15 ++++++++++++--- jim_tcl.txt | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/jim-package.c b/jim-package.c index 8b37c0a..1d42197 100644 --- a/jim-package.c +++ b/jim-package.c @@ -190,7 +190,7 @@ static int package_cmd_require(Jim_Interp *interp, int argc, Jim_Obj *const *arg /* *---------------------------------------------------------------------- * - * package list + * package list|names * * Returns a list of known packages * @@ -199,7 +199,7 @@ static int package_cmd_require(Jim_Interp *interp, int argc, Jim_Obj *const *arg * *---------------------------------------------------------------------- */ -static int package_cmd_list(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +static int package_cmd_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_HashTableIterator *htiter; Jim_HashEntry *he; @@ -236,7 +236,16 @@ static const jim_subcmd_type package_command_table[] = { { "list", NULL, - package_cmd_list, + package_cmd_names, + 0, + 0, + JIM_MODFLAG_HIDDEN + /* Description: Deprecated - Lists all known packages */ + }, + { + "names", + NULL, + package_cmd_names, 0, 0, /* Description: Lists all known packages */ diff --git a/jim_tcl.txt b/jim_tcl.txt index c4d8996..159dea9 100644 --- a/jim_tcl.txt +++ b/jim_tcl.txt @@ -3455,6 +3455,10 @@ otherwise if '$name.tcl' exists it is loaded with the `source` command. If `load` or `source` fails, `package require` will fail immediately. No further attempt will be made to locate the file. ++*package names*+ + +Returns a list of all known/loaded packages, including internal packages. + pid ~~~ +*pid*+ -- 2.11.4.GIT