changeset 6616:66e30383481b

[project @ 2007-05-14 13:56:34 by dbateman]
author dbateman
date Mon, 14 May 2007 13:56:34 +0000
parents 687ae48b2253
children 55da54f6c5c2
files doc/ChangeLog doc/interpreter/package.txi scripts/ChangeLog scripts/pkg/pkg.m
diffstat 4 files changed, 32 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog	Sun May 13 06:24:58 2007 +0000
+++ b/doc/ChangeLog	Mon May 14 13:56:34 2007 +0000
@@ -1,3 +1,7 @@
+2007-04-18  Søren Hauberg  <hauberg@gmail.com>
+
+	* interpreter/package.texi: Document "*" flag for loaded packages.
+
 2007-05-09  David Bateman  <dbateman@free.fr>
 
 	* faq/Octave-FAQ.texi: Update compatibility section.
--- a/doc/interpreter/package.txi	Sun May 13 06:24:58 2007 +0000
+++ b/doc/interpreter/package.txi	Mon May 14 13:56:34 2007 +0000
@@ -49,15 +49,16 @@
 @example
 @group
 pkg list
-     @print{} Package Name | Version | Installation directory
-     @print{} -------------+---------+-----------------------
-     @print{}        image |   1.0.0 | /home/jwe/octave/image-1.0.0
+     @print{} Package Name  | Version | Installation directory
+     @print{} --------------+---------+-----------------------
+     @print{}        image *|   1.0.0 | /home/jwe/octave/image-1.0.0
 @end group
 @end example
 
 @noindent
 In this case only version 1.0.0 of the @code{image} package is
-installed.
+installed. The '*' character next to the package name shows that the
+image package is loaded and ready for use.
 
 It is possible to remove a package from the system using the
 @code{pkg uninstall} command like this
--- a/scripts/ChangeLog	Sun May 13 06:24:58 2007 +0000
+++ b/scripts/ChangeLog	Mon May 14 13:56:34 2007 +0000
@@ -1,3 +1,7 @@
+2007-05-14  David Bateman  <dbateman@free.fr>
+
+	* pkg/pkg.m: Mark loaded packages with "*".
+
 2007-05-13  Søren Hauberg <soren@hauberg.org>
 
 	* miscellaneous/single.m: Doc fix.
--- a/scripts/pkg/pkg.m	Sun May 13 06:24:58 2007 +0000
+++ b/scripts/pkg/pkg.m	Mon May 14 13:56:34 2007 +0000
@@ -45,7 +45,7 @@
 ## automatically load the installed package when starting Octave,
 ## even if the package requests that it isn't.
 ##
-## Final if @var{option} is @code{-verbose} the package manager will
+## Finally, if @var{option} is @code{-verbose} the package manager will
 ## print the output of all of the commands that are performed
 ## @item uninstall
 ## Uninstall named packages.  For example,
@@ -1238,6 +1238,16 @@
     installed_packages(dup) = [];
   endif  
 
+  ## Now check if the package is loaded
+  tmppath = path();
+  for i = 1:length (installed_packages)
+    if (regexp (tmppath, installed_packages{i}.dir))
+      installed_packages{i}.loaded = true;
+    else
+      installed_packages{i}.loaded = false;
+    endif
+  endfor
+
   ## Should we return something?
   if (nargout == 2)
     out1 = local_packages;
@@ -1269,7 +1279,7 @@
 			      length (installed_packages{i}.version));
     names{i} = installed_packages{i}.name;
   endfor
-  h1 = postpad (h1, max_name_length, " ");
+  h1 = postpad (h1, max_name_length + 1, " ");
   h2 = postpad (h2, max_version_length, " ");;
 
   ## Print a header
@@ -1281,14 +1291,19 @@
   printf ("%s\n", tmp);
 
   ## Print the packages
-  format = sprintf ("%%%ds | %%%ds | %%s\n", max_name_length,
+  format = sprintf ("%%%ds %%1s| %%%ds | %%s\n", max_name_length,
 		    max_version_length);
   [dummy, idx] = sort (names);
   for i = 1:num_packages
     cur_name = installed_packages{idx(i)}.name;
     cur_version = installed_packages{idx(i)}.version;
     cur_dir = installed_packages{idx(i)}.dir;
-    printf (format, cur_name, cur_version, cur_dir);
+    if (installed_packages{idx(i)}.loaded)
+      cur_loaded = "*";
+    else
+      cur_loaded = " ";
+    endif
+    printf (format, cur_name, cur_loaded, cur_version, cur_dir);
   endfor
 endfunction