Mercurial > hg > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
9529:8e5009334661 | 9530:f3df413338c5 |
---|---|
31 if (numel (x) > 1) | 31 if (numel (x) > 1) |
32 name = x (2).name; | 32 name = x (2).name; |
33 else | 33 else |
34 error ("print_usage: invalid function\n"); | 34 error ("print_usage: invalid function\n"); |
35 endif | 35 endif |
36 path = evalin ("caller", "mfilename (""fullpath"")"); | |
37 if (strcmp (path(end-length(name)+1:end), name)) | |
38 path = [path, ".m"]; | |
39 else | |
40 path = name; | |
41 endif | |
36 elseif (!ischar (name)) | 42 elseif (!ischar (name)) |
37 error ("print_usage: input argument must be a string"); | 43 error ("print_usage: input argument must be a string"); |
38 endif | 44 endif |
39 | 45 |
40 ## Do the actual work | 46 ## Do the actual work |
41 [text, format] = get_help_text (name); | 47 [text, format] = get_help_text (path); |
42 max_len = 80; | 48 max_len = 80; |
43 switch (lower (format)) | 49 switch (lower (format)) |
44 case "plain text" | 50 case "plain text" |
45 [usage_string, status] = get_usage_plain_text (text, max_len); | 51 [usage_string, status] = get_usage_plain_text (text, max_len); |
46 case "texinfo" | 52 case "texinfo" |