[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how can I display the doc message from a command?
From: |
John W. Eaton |
Subject: |
Re: how can I display the doc message from a command? |
Date: |
Wed, 13 Sep 2006 10:00:39 -0400 |
On 13-Sep-2006, Andrea Latina wrote:
| > from a command defined by
| >
| > DEFUN_DLD or DEFUN (or DEFCMD, ..)
| >
| > how can I display its own doc message?
|
| Finally I've done like this:
|
| if (args.length()==0)
| feval("help", octave_value("CommandName"), 0);
|
| is this the best way or I can avoid to call feval??
Are you sure you really want the full help text? Comments from users
have shown that most are confused when a usage error results in the
full help text appearing, especially when the help text comes from
some incorrect code that is buried deep inside some large program.
The recommended way to handle usage messages is with the print_usage
function:
if (args.length () == 0)
print_usage ();
If the doc string uses Texinfo markup, this will extract just the
@deftypefn or @defcmd lines from the doc string and display them in a
nicely formatted way. For example:
octave:1> svd
Invalid call to svd. Correct usage is:
-- Loadable Function: S = svd (A)
-- Loadable Function: [U, S, V] = svd (A)
Additional help for built-in functions and operators is
available in the on-line version of the manual. Use the command
`doc <topic>' to search the manual index.
Help and information about Octave is also available on the WWW
at http://www.octave.org and via the address@hidden
mailing list.
jwe