diff scripts/help/print_usage.m @ 9530:f3df413338c5

print_usage: support calling from methods
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 17 Aug 2009 13:59:26 +0200
parents e0fbf17a17bb
children 936734e15a4d
line wrap: on
line diff
--- a/scripts/help/print_usage.m
+++ b/scripts/help/print_usage.m
@@ -33,12 +33,18 @@
     else
       error ("print_usage: invalid function\n");
     endif
+    path = evalin ("caller", "mfilename (""fullpath"")");
+    if (strcmp (path(end-length(name)+1:end), name))
+      path = [path, ".m"];
+    else
+      path = name;
+    endif
   elseif (!ischar (name))
     error ("print_usage: input argument must be a string");
   endif
   
   ## Do the actual work
-  [text, format] = get_help_text (name);
+  [text, format] = get_help_text (path);
   max_len = 80;
   switch (lower (format))
     case "plain text"