comparison scripts/help/help.m @ 8748:d1eed318100f

help.m: shorten default help text
author John W. Eaton <jwe@octave.org>
date Mon, 16 Feb 2009 00:38:25 -0500
parents 5dd06f19e9be
children e0fbf17a17bb
comparison
equal deleted inserted replaced
8747:86cfcf133a19 8748:d1eed318100f
28 ## for those, you must type @kbd{help comma} or @kbd{help semicolon}. 28 ## for those, you must type @kbd{help comma} or @kbd{help semicolon}.
29 ## @seealso{doc, which, lookfor} 29 ## @seealso{doc, which, lookfor}
30 ## @end deftypefn 30 ## @end deftypefn
31 31
32 function help (name) 32 function help (name)
33
33 if (nargin == 0) 34 if (nargin == 0)
34 disp ("Help is available for the topics listed below.");
35 disp ("");
36
37 disp ("*** operators:");
38 operators = __operators__ ();
39 disp (list_in_columns (operators (:, 1)));
40 35
41 disp ("*** reserved words:"); 36 puts ("\n\
42 keywords = __keywords__ (); 37 For help with individual commands and functions type\n\
43 disp (list_in_columns (keywords (:, 1))); 38 \n\
39 help NAME\n\
40 \n\
41 (replace NAME with the name of the command or function you would\n\
42 like to learn more about).\n\
43 \n\
44 For a more detailed introduction to GNU Octave, please consult the\n\
45 manual. To read the manual from the prompt type\n\
46 \n\
47 doc\n\
48 \n\
49 GNU Octave is supported and developed by its user community.\n\
50 For more information visit http://www.octave.org.\n\n");
44 51
45 disp ("*** available functions:");
46 functions = __list_functions__ ();
47 disp (list_in_columns (functions));
48
49 elseif (nargin == 1 && ischar (name)) 52 elseif (nargin == 1 && ischar (name))
53
50 ## Get help text 54 ## Get help text
51 [text, format] = get_help_text (name); 55 [text, format] = get_help_text (name);
52 56
53 ## Take action depending on help text format 57 ## Take action depending on help text format
54 switch (lower (format)) 58 switch (lower (format))
69 error ("help: internal error: unsupported help text format: '%s'\n", format); 73 error ("help: internal error: unsupported help text format: '%s'\n", format);
70 endswitch 74 endswitch
71 75
72 ## Print text 76 ## Print text
73 if (status != 0) 77 if (status != 0)
74 warning ("makeinfo: Texinfo formatting filter exited abnormally"); 78 warning ("makeinfo: Texinfo formatting filter exited abnormally; raw Texinfo source of help text follows...\n");
75 warning ("makeinfo: raw Texinfo source of help text follows...\n");
76 endif 79 endif
77 80
78 which (name); 81 which (name);
79 printf ("\n%s\n%s", text, __additional_help_message__ ()); 82 printf ("\n%s\n%s", text, __additional_help_message__ ());
80 83
81 else 84 else
82 error ("help: invalid input\n"); 85 error ("help: invalid input\n");
83 endif 86 endif
87
84 endfunction 88 endfunction
85 89
86 function [text, status] = do_contents (name) 90 function [text, status] = do_contents (name)
87 text = ""; 91 text = "";
88 status = 1; 92 status = 1;
108 ## Restore path 112 ## Restore path
109 path (p); 113 path (p);
110 end_unwind_protect 114 end_unwind_protect
111 endif 115 endif
112 endfunction 116 endfunction
113