Contents
Display command line shell examples in Trac wiki pages
Description
This is a wiki processor to display command line shell examples in Trac wiki pages.
This plugin has only been tested on Trac 0.12, and may work for later versions.
A typical example might look like this:
{{{
#!ShellExample
(full example showing how to use openssl to connect to a pops mail server)
$ openssl s_client -connect mail.foo.com:995
CONNECTED(00000003)
depth=0 /C=US/ST=Nowhere/O=Foo/OU=bar/CN=mail.foo.com
$$---
---
+OK Dovecot ready. <1c32.1a611.4c4859c2.BEuUvAEtnt0du+msvFig0w==@mail.foo.com>
$$ user {username}
+OK
$$ pass {password}
+OK Logged in.
$$ stat
+OK 509 15659197
$$ quit
+OK Logging out.
closed
}}}
Produces output like this:
Additional examples are available here.
Technical Details
This is a WikiProcessor so it is used with the standard #! notation. This processor injects css code into Trac, so you should get formatted output by default. Any tagged code is inside a span element, and the following classes are used:
- se-input
- se-input-userreplacement
- se-input-string
- se-input-continuation
- se-input-option
- se-input-delayed
- se-prompt
- se-prompt-start
- se-prompt-user
- se-prompt-userhostseparator
- se-prompt-host
- se-prompt-path
- se-prompt-end
- se-root
- se-unprivileged
- se-note
- se-output
- se-output-snipped
{{{
#!ShellExample
{user@foo ~/path/to}$ foo --user {username}
}}}
results in something like the following (expanded for easier reading):
<div class="code"> <pre> <span class="se-prompt"> <span class="se-prompt-start">{</span> <span class="se-prompt-user">user</span> <span class="se-prompt-userhostseparator">@</span> <span class="se-prompt-host">foo</span> <span class="se-prompt-path">~/path/to</span> <span class="se-prompt-end">}</span> </span> <span class="se-unprivileged">$ </span> <span class="se-input">foo <span class="se-input-option">--user</span> <span class="se-input-userreplacement">{username}</span></span> </pre> </div>
Bugs/Feature Requests
Existing bugs and feature requests for ShellExampleMacro are here.
If you have any issues, create a new ticket.
| defect |
2 / 2 |
|
|---|---|---|
| enhancement |
0 / 2 |
Download
Download the current source (0.12.2) from here.
There is also a version on PyPi.
Source
You can check out ShellExampleMacro from here using Subversion, or browse the source with Trac.
Installation
You can install this software as a normal Trac plugin.
- Uninstall ShellExample wiki processor if you have installed before.
- Change to the directory containing
setup.py. - If you want to install this plugin globally, that will install this plugin to the Python path:
python setup.py install - If you want to install this plugin to Trac instance only:
python setup.py bdist_egg copy the generated egg file to the trac instance's plugin directory cp dist/*.egg /srv/trac/env/plugins
- Configure your
trac.inifile:[components] shellexample.* = enabled
Recent Changes
- 11485 by rjollos on 2012-04-14 00:37:00
-
Fixes #9900:
get_templates_dirsneeds to return an empty list, but it was returningNone. This should fix a reported instance of the AnnouncerPlugin throwing an error.
- 11484 by rjollos on 2012-04-14 00:26:50
-
Removed empty directory.
- 10269 by nmadura on 2011-06-08 19:48:59
-
tagged 0.12.2 release
(more)
Author/Contributors
This plugin was originally developed by mOo. Nathaniel Madura significantly updated this plugin, and took over maintenance of it.
Author: nmadura
Maintainer: Nathaniel Madura
Contributors:
Attachments (1)
-
ShellExample-example.png (42.4 KB) - added by 15 years ago.
Example of processed text
Download all attachments as: .zip



