Mercurial > octave-nkf
comparison scripts/help/help.m @ 10625:07933067e4ab
help.m: Allow docstring to be returned as output, and correct docstring.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Wed, 12 May 2010 17:49:28 -0400 |
parents | 95c3e38098bf |
children | 69a715c81eab |
comparison
equal
deleted
inserted
replaced
10624:3eafa521550b | 10625:07933067e4ab |
---|---|
13 ## You should have received a copy of the GNU General Public License | 13 ## You should have received a copy of the GNU General Public License |
14 ## along with this program; see the file COPYING. If not, see | 14 ## along with this program; see the file COPYING. If not, see |
15 ## <http://www.gnu.org/licenses/>. | 15 ## <http://www.gnu.org/licenses/>. |
16 | 16 |
17 ## -*- texinfo -*- | 17 ## -*- texinfo -*- |
18 ## @deffn {Command} help @var{name} | 18 ## @deftypefn {Function File} {} help @var{name} |
19 ## Display the help text for @var{name}. | 19 ## Display the help text for @var{name}. |
20 ## If invoked without any arguments, @code{help} prints a list | 20 ## If invoked without any arguments, @code{help} displays instructions |
21 ## of all the available operators and functions. | 21 ## on how to access help from the command line. |
22 ## | 22 ## |
23 ## For example, the command @kbd{help help} prints a short message | 23 ## For example, the command @kbd{help help} prints a short message |
24 ## describing the @code{help} command. | 24 ## describing the @code{help} command. |
25 ## | |
26 ## @deftypefnx {Function File} {@var{text} =} help (@var{name}) | |
27 ## Return the help text for the function, @var{name}. | |
25 ## | 28 ## |
26 ## The help command can give you information about operators, but not the | 29 ## The help command can give you information about operators, but not the |
27 ## comma and semicolons that are used as command separators. To get help | 30 ## comma and semicolons that are used as command separators. To get help |
28 ## for those, you must type @kbd{help comma} or @kbd{help semicolon}. | 31 ## for those, you must type @kbd{help comma} or @kbd{help semicolon}. |
29 ## @seealso{doc, lookfor, which} | 32 ## @seealso{doc, lookfor, which} |
30 ## @end deffn | 33 ## @end deftypefn |
31 | 34 |
32 function help (name) | 35 function varargout = help (name) |
33 | 36 |
34 if (nargin == 0) | 37 if (nargin == 0) |
35 | 38 |
36 puts ("\n\ | 39 puts ("\n\ |
37 For help with individual commands and functions type\n\ | 40 For help with individual commands and functions type\n\ |
74 ## Print text | 77 ## Print text |
75 if (status != 0) | 78 if (status != 0) |
76 warning ("help: Texinfo formatting filter exited abnormally; raw Texinfo source of help text follows...\n"); | 79 warning ("help: Texinfo formatting filter exited abnormally; raw Texinfo source of help text follows...\n"); |
77 endif | 80 endif |
78 | 81 |
79 which (name); | 82 if (nargout == 0) |
80 printf ("\n%s\n%s", text, __additional_help_message__ ()); | 83 which (name); |
84 printf ("\n%s\n%s", text, __additional_help_message__ ()); | |
85 else | |
86 varargout = {text}; | |
87 endif | |
81 | 88 |
82 else | 89 else |
83 error ("help: invalid input\n"); | 90 error ("help: invalid input\n"); |
84 endif | 91 endif |
85 | 92 |