diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-25 14:11:44 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2013-09-25 14:12:41 +0900 |
commit | e655a98f3dc1b23dedaa406d290e24d78e220742 (patch) | |
tree | 956769e517ea5fa2f2c63abbef9375afcb4e8b0c | |
parent | cf9f9495bb4e621b5a2e5713804d507752dfbb7d (diff) | |
download | pygerrit-e655a98f3dc1b23dedaa406d290e24d78e220742.tar.gz |
Add more detailed examples of SSH interface usage in the README
Refs #9
Change-Id: I335782f5b3126ee00ba8fbe43372c02e7506eb35
-rw-r--r-- | README.rst | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -31,6 +31,24 @@ file: Port 29418 User username +SSH Interface +------------- + +The SSH interface can be used to run commands on the Gerrit server. + +.. code-block:: pycon + + >>> from pygerrit.ssh import GerritSSHClient + >>> client = GerritSSHClient("review") + >>> result = client.run_gerrit_command("version") + >>> result + <GerritSSHCommandResult [version]> + >>> result.stdout + <paramiko.ChannelFile from <paramiko.Channel 2 (closed) -> <paramiko.Transport at 0xd2387d90L (cipher aes128-cbc, 128 bits) (active; 0 open channel(s))>>> + >>> result.stdout.read() + 'gerrit version 2.6.1\n' + >>> + Event Stream ------------ @@ -44,8 +62,23 @@ client to fetch them from a queue. It also allows users to easily add handling of custom event types, for example if they are running a customised Gerrit installation with non-standard events. -Refer to the `example`_ script for a brief example of how the interface -works. +.. code-block:: pycon + + >>> from pygerrit.client import GerritClient + >>> client = GerritClient("review") + >>> client.gerrit_version() + '2.6.1' + >>> client.start_event_stream() + >>> client.get_event() + <CommentAddedEvent>: <Change 12345, platform/packages/apps/Example, master> <Patchset 1, 5c4b2f76297f04fbab77eb8c3462e087bc4b6f90> <Account Bob Example (bob.example@example.com)> + >>> client.get_event() + <CommentAddedEvent>: <Change 67890, platform/frameworks/example, master> <Patchset 2, c7d4f9956c80b1df66a66d66dea3960e71de4910> <Account John Example (john.example@example.com)> + >>> client.stop_event_stream() + >>> + + +Refer to the `example`_ script for a more detailed example of how the SSH +event stream interface works. Copyright and License |