CLI Demo

Overview

This jQuery plugin provides a simple way to create CLI demonstration.

Quick Start

Execute the actual CLI operations:
$ ls /usr/lib
anaconda-runtime  games  locale     rpm       sendmail.postfix
ConsoleKit        gcc    python2.6  sendmail  yum-plugins
$ ls /var/lib
alternatives  dhclient          nfs       random-seed  stateless
authconfig    games             plymouth  rhsm         udev
cs            logrotate.status  polkit-1  rpm          up2date
dbus          misc              postfix   rsyslog      yum
$  
Copy and paste the CLI input and output into a <div class="cli-demo"> or <pre class="cli-demo"> in an HTML page. Mark the parts that are manually typed with <span class="cli-demo-input">.
<html>
<head> ... </head>
<body>

<div class="cli-demo">$ <span class="cli-demo-input">ls /usr/lib</span>
anaconda-runtime  games  locale     rpm       sendmail.postfix
ConsoleKit        gcc    python2.6  sendmail  yum-plugins
$ <span class="cli-demo-input">ls /var/lib</span>
alternatives  dhclient          nfs       random-seed  stateless
authconfig    games             plymouth  rhsm         udev
cs            logrotate.status  polkit-1  rpm          up2date
dbus          misc              postfix   rsyslog      yum
$ </div>

</body>
</html>
Include the JS and CSS files in the header and execute the plugin:
<html>
<head>
    <link href="css/cli-demo.css" rel="stylesheet" type="text/css"/>
    <script src="//code.jquery.com/jquery.js"></script>
    <script src="js/cli-demo.js"></script>
    <script>
$(function() {
    $(".cli-demo").cli_demo();
});
    </script>
</head>
<body>
    ...
</body>
</html>
Result:
$ ls /usr/lib anaconda-runtime games locale rpm sendmail.postfix ConsoleKit gcc python2.6 sendmail yum-plugins $ ls /var/lib alternatives dhclient nfs random-seed stateless authconfig games plymouth rhsm udev cs logrotate.status polkit-1 rpm up2date dbus misc postfix rsyslog yum $

Examples

Repository

git://fedorapeople.org/home/fedora/edewata/public_git/cli-demo.git