Module helpmanager :: Class HelpManager
[show private | hide private]
[frames | no frames]

Class HelpManager

Manager --+
          |
         HelpManager


The HelpManager exists on the engine scoping--there is only one per Lyntin instance. It holds a hierarchy of help texts which can be retrieved and perused through via the #help user command. In general, it's best to access the HelpManager instance through the exported module.

Help texts are indexed by an 'fqn' which is a fully-qualified-name. For example, the #alias command would be under 'commands.alias' where 'commands' is the category in the help hierarchy that it goes under and 'alias' is the help text topic name.

Help text can also handle options set in the text in itself. Currently the only option we support is "category". This will be used if the fqn you supply to the addHelp call is lacking a category--for example 'alias'.

FIXME - needs more info here
Method Summary
  __init__(self)
string addHelp(self, fqn, helptext)
Adds a help text to the hierarchy.
  addSession(self, newsession, basesession)
Tells the manager to create a new session based on another session. (inherited from Manager)
  clear(self, ses)
Removes everything the manager was managing--essentially reinitializes it. (inherited from Manager)
tuple of (string, string, string) getHelp(self, fqn)
Retrieves the help topic requested.
string getInfo(self, ses, text)
Returns information managed by this class. (inherited from Manager)
(string, list of strings) getNode(self, fqn)
Retrieves the help topic requested.
list of strings getState(self, ses)
Returns the state of something as a list of command strings without the command char (which is added by #write). (inherited from Manager)
string getStatus(self, ses)
Returns a one-liner status of the state of this manager for a given session. (inherited from Manager)
  removeHelp(self, fqn)
Takes in a fully-qualified name and attempts to remove it from the structure.
  removeSession(self, ses)
Tells the manager to remove information regarding the session. (inherited from Manager)

Method Details

addHelp(self, fqn, helptext)

Adds a help text to the hierarchy. Use the 'exported.add_help' and not this directly.
Parameters:
fqn - the fully qualified name
           (type=string)
helptext - the help text
           (type=string)
Returns:
the fqn of the help topic we just added (this can change depending on whether there's a category directive)
           (type=string)
Raises:
ValueError - if the help name or help text are not valid

getHelp(self, fqn)

Retrieves the help topic requested. This is the hard-core attempt at finding help text. It will look for it outright, then try searching, then try black magic.
Parameters:
fqn - the fully qualified name or topic name
           (type=string)
Returns:
A tuple composed of three strings. The first string is error text (if any or empty string if none). The second string is the breadcrumbs trail. The third string is the help text found or a columnized text of what tree elements exist at that level.
           (type=tuple of (string, string, string))

getNode(self, fqn)

Retrieves the help topic requested.

The difference between this and getHelp is that getHelp will do searching and try to find the best topic for what you asked for. This will return the topic at the prescribed place or throw an exception if it doesn't exist. This is better for exporting help topics to a manual of some kind.
Parameters:
fqn - the fully qualified name of the topic being requested
           (type=string)
Returns:
a tuple consisting of the topic data string, and then a list of nodes under this fqn (if it's a category)
           (type=(string, list of strings))
Raises:
ValueError - if the fqn doesn't exist

removeHelp(self, fqn)

Takes in a fully-qualified name and attempts to remove it from the structure.
Parameters:
fqn - the fully qualified name of the help topic to remove
           (type=string)
Raises:
ValueError - if no topic by that fqn exists

Generated by Epydoc 1.1 on Mon Apr 28 21:11:25 2003 http://epydoc.sf.net