Mercurial > hg > octave-nkf
changeset 15026:ae42d5a67ed9
help.m: Added option '.' (dot); 'help .' lists all operators
author | Sergey Dudoladov <sergey.dudoladov@gmail.com> |
---|---|
date | Mon, 23 Jul 2012 12:18:07 +0400 |
parents | f23e60748072 |
children | 741d2dbcc117 397f0d80bd47 |
files | scripts/help/help.m |
diffstat | 1 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/help/help.m +++ b/scripts/help/help.m @@ -19,6 +19,7 @@ ## -*- texinfo -*- ## @deftypefn {Command} {} help @var{name} ## @deftypefnx {Command} {} help @code{--list} +## @deftypefnx {Command} {} help @code{.} ## Display the help text for @var{name}. For example, the command ## @kbd{help help} prints a short message describing the @code{help} ## command. @@ -27,6 +28,9 @@ ## keywords, built-in functions, and loadable functions available ## in the current session of Octave. ## +## Given the single argument @code{.}, list all operators available +## in the current session of Octave. +## ## If invoked without any arguments, @code{help} display instructions ## on how to access help from the command line. ## @@ -68,6 +72,16 @@ return; endif + if (strcmp (name, ".")) + tmp = do_list_operators (); + if (nargout == 0) + printf ("%s", tmp); + else + retval = tmp; + endif + return; + endif + ## Get help text [text, format] = get_help_text (name); @@ -106,10 +120,15 @@ endfunction +function retval = do_list_operators () + + retval = sprintf ("*** operators:\n\n%s\n\n", + list_in_columns (__operators__ ())); +endfunction + function retval = do_list_functions () - operators = sprintf ("*** operators:\n\n%s\n\n", - list_in_columns (__operators__ ())); + operators = do_list_operators (); keywords = sprintf ("*** keywords:\n\n%s\n\n", list_in_columns (__keywords__ ()));