summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-09-25 15:05:45 -0700
committerThomas Kluyver <takowl@gmail.com>2013-09-25 15:05:45 -0700
commit137f605dd0f25511e83e1bfb455676e2498fe7a2 (patch)
tree0a437c2841c55b874a3a3d966186d6663453c794
parent5a38ba61cebf6d73627a522bf371679762dd7651 (diff)
downloadpexpect-git-137f605dd0f25511e83e1bfb455676e2498fe7a2.tar.gz
Document pxssh module
-rw-r--r--doc/api/index.rst3
-rw-r--r--doc/api/pxssh.rst29
-rw-r--r--pexpect/pxssh.py20
3 files changed, 42 insertions, 10 deletions
diff --git a/doc/api/index.rst b/doc/api/index.rst
index 29303fd..3b245d1 100644
--- a/doc/api/index.rst
+++ b/doc/api/index.rst
@@ -5,4 +5,5 @@ API documentation
:maxdepth: 2
pexpect
- fdpexpect \ No newline at end of file
+ fdpexpect
+ pxssh \ No newline at end of file
diff --git a/doc/api/pxssh.rst b/doc/api/pxssh.rst
new file mode 100644
index 0000000..91b7fe0
--- /dev/null
+++ b/doc/api/pxssh.rst
@@ -0,0 +1,29 @@
+pxssh module
+============
+
+.. automodule:: pexpect.pxssh
+
+.. autoclass:: ExceptionPxssh
+
+pxssh class
+-----------
+
+.. autoclass:: pxssh
+
+ .. automethod:: __init__
+
+ .. attribute:: auto_prompt_reset
+
+ Set this to False to prevent :meth:`login` from setting a unique prompt
+ which can easily be located.
+
+ .. attribute:: PROMPT
+
+ The regex pattern to search for to find the prompt. If
+ :attr:`auto_prompt_reset` is False, you must set this attribute manually.
+
+ .. automethod:: login
+ .. automethod:: logout
+ .. automethod:: prompt
+ .. automethod:: sync_original_prompt
+ .. automethod:: set_unique_prompt \ No newline at end of file
diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py
index 5566029..8521df5 100644
--- a/pexpect/pxssh.py
+++ b/pexpect/pxssh.py
@@ -199,10 +199,10 @@ class pxssh (spawn):
prompt was so weird that we could not match it, so we use a few tricks
to guess when we have reached the prompt. Then we hope for the best and
blindly try to reset the prompt to something more unique. If that fails
- then login() raises an ExceptionPxssh exception.
+ then login() raises an :class:`ExceptionPxssh` exception.
In some situations it is not possible or desirable to reset the
- original prompt. In this case, set 'auto_prompt_reset' to False to
+ original prompt. In this case, set :attr:`auto_prompt_reset` to False to
inhibit setting the prompt to the UNIQUE_PROMPT. Remember that pxssh
uses a unique prompt in the prompt() method. If the original prompt is
not reset then this will disable the prompt() method unless you
@@ -303,11 +303,13 @@ class pxssh (spawn):
'''This matches the shell prompt. This is little more than a short-cut
to the expect() method. This returns True if the shell prompt was
matched. This returns False if a timeout was raised. Note that if you
- called login() with auto_prompt_reset set to False then before calling
- prompt() you must set the PROMPT attribute to a regex that prompt()
- will use for matching the prompt. Calling prompt() will erase the
- contents of the 'before' attribute even if no prompt is ever matched.
- If timeout is not given or it is set to -1 then self.timeout is used.
+ called :meth:`login` with :attr:`auto_prompt_reset` set to False then
+ before calling :meth:`prompt` you must set the :attr:`PROMPT` attribute
+ to a regex that it will use for matching the prompt.
+
+ Calling :meth:`prompt` will erase the contents of the :attr:`before`
+ attribute even if no prompt is ever matched. If timeout is not given or
+ it is set to -1 then self.timeout is used.
'''
if timeout == -1:
@@ -320,8 +322,8 @@ class pxssh (spawn):
def set_unique_prompt (self):
'''This sets the remote prompt to something more unique than # or $.
- This makes it easier for the prompt() method to match the shell prompt
- unambiguously. This method is called automatically by the login()
+ This makes it easier for the :meth:`prompt` method to match the shell prompt
+ unambiguously. This method is called automatically by the :meth:`login`
method, but you may want to call it manually if you somehow reset the
shell prompt. For example, if you 'su' to a different user then you
will need to manually reset the prompt. This sends shell commands to