changeset 31444:2569c40924e7 stable

which.m: Add warning for unimplemented '-all' option (bug #32088) * which.m: Check for use of '-all' and issue a warning to the user instead of silently ignoring the option. Remove any instance of '-all' from varargin and adjust nargin accordingly. Add a BIST to verify the warning is triggered and a FIXME note referring to the bug report.
author Nicholas R. Jankowski <jankowski.nicholas@gmail.com>
date Tue, 15 Nov 2022 17:40:23 -0500
parents 38139b13192c
children 0924234dd747
files scripts/help/which.m
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/help/which.m	Tue Nov 15 14:34:28 2022 -0800
+++ b/scripts/help/which.m	Tue Nov 15 17:40:23 2022 -0500
@@ -38,6 +38,15 @@
     print_usage ();
   endif
 
+  ## FIXME: "-all" option not implemented.  Warn user that only the first
+  ##        result found will be returned.  See bug #32088.
+  if (any (isall = strcmpi (varargin, "-all")))
+    warning (["which: '-all' not yet implemented - only the first result ", ...
+             "will be returned\n"]);
+    varargin = varargin(! isall);
+    nargin = nargin - sum (isall);
+  endif
+
   m = __which__ (varargin{:});
 
   ## Check whether each name is a variable, variables take precedence over
@@ -113,4 +122,5 @@
 
 %!error <Invalid call> which ()
 %!error <Invalid call> which (1)
+%!warning <'-all' not yet implemented> which ("1", "-all")