|
1 | | -# cli-plugin |
2 | | -CLI plugin for webapps |
| 1 | +# CLI Plugin |
| 2 | +CLI plugin is a simple and easy to use CLI for web applications. |
| 3 | + |
| 4 | +This is project originated from my fascination with minimalistic user interfaces. |
| 5 | +While rich in functionality - a good CLI is never distracting. |
| 6 | + |
| 7 | +Features: |
| 8 | +- keeps history of used commands |
| 9 | +- configurable colorschemes |
| 10 | + |
| 11 | +## Demo |
| 12 | +Click <a href="https://rawgit.com/g1eb/cli-plugin/master/" target="_blank">here</a> for a live demo. |
| 13 | + |
| 14 | +## Install |
| 15 | + |
| 16 | +- Install 'cli-plugin' with bower |
| 17 | + |
| 18 | +``` |
| 19 | +bower install cli-plugin |
| 20 | +``` |
| 21 | + |
| 22 | +- Install 'cli-plugin' with npm |
| 23 | + |
| 24 | +``` |
| 25 | +npm install cli-plugin |
| 26 | +``` |
| 27 | + |
| 28 | +- Or include files directly in your html: |
| 29 | + |
| 30 | +``` |
| 31 | +<link rel="stylesheet" type="text/css" href="dist/cli-plugin.min.css"> |
| 32 | +<script src="dist/cli-plugin.min.js"></script> |
| 33 | +``` |
| 34 | + |
| 35 | +### Setup |
| 36 | + |
| 37 | +Initialize cliPlugin using a custom colorscheme/config file. |
| 38 | + |
| 39 | +``` |
| 40 | +cliPlugin.init(config); |
| 41 | +``` |
| 42 | + |
| 43 | +Config accepts following properties: |
| 44 | + |
| 45 | +|Property | Usage | Default | Required | |
| 46 | +|:------------- |:-------------|:-----:|:-----:| |
| 47 | +| textColor | text color | #111111 | no | |
| 48 | +| cursorColor | cursor color | #111111 | no | |
| 49 | +| backgroundColor | background color | whitesmoke | no | |
| 50 | + |
| 51 | +Feel free to use hex, rgb(a) or html5 color names :) |
| 52 | + |
| 53 | +### Register commands |
| 54 | + |
| 55 | +Register your own commands: |
| 56 | + |
| 57 | +``` |
| 58 | +cliPlugin.bind('list', function () { |
| 59 | + cliPlugin.print('<p>items on the shopping list:</p>'); |
| 60 | + cliPlugin.print('<ul><li>milk</li><li>bacon</li><li>eggs</li></ul>'); |
| 61 | +}); |
| 62 | +``` |
| 63 | + |
| 64 | +### Useful functions |
| 65 | + |
| 66 | +Use ```cliPlugin.print(text)``` command to print text on the screen, accepts html. |
| 67 | + |
| 68 | +Use ```cliPlugin.clear()``` command to clear the screen. |
| 69 | + |
| 70 | +### Example |
| 71 | + |
| 72 | +See [index.html](https://github.com/g1eb/cli-plugin/blob/master/index.html) for an example implementation. |
0 commit comments