jQuery Command Line Interpreter Plugin Terminal Emulator - Free Download jQuery Command Line Interpreter Plugin - Terminal Emulator

Free Download jQuery Command Line Interpreter Plugin – Terminal Emulator

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Command Line Interpreter Plugin – Terminal Emulator, hope it will help you in programming stack.

jQuery Command Line Interpreter Plugin Terminal Emulator - Free Download jQuery Command Line Interpreter Plugin - Terminal Emulator
File Size: 958 KB
Views Total: 14183
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A simple jQuery based terminal emulator that makes it easy to create command line interpreter for your website or web application.

Command Line Interpreter is a blanket term for a certain class of programs designed to read lines of text entered by a user, thus implementing a command-line interface.(More info about Command Line Interpreter on WIKI). 

Licensed under GNU LGPL Version 3 license.

You might also like:

Main Features:

  • Automatically call JSON-RPC service.
  • You can provide your own function in which you can parse user command.
  • Command Tree supported
  • Command line history supported
  • Tab completion supported
  • Keyboard shortcut like CTRL+A, CTRL+D, CTRL+E etc, supported
  • Authentication supported
  • Multiple Command Line Interpreters on one page supported

Installation:

1 # NPM
2 $ npm install jquery.terminal
3  
4 # Bower
5 $ bower install jquery.terminal

Basic Usage:

1. Include jQuery JavaScript library and the terminal emulator plugin’s files on your page.

1 <link href="css/jquery.terminal.min.css" rel="stylesheet" />
2 <script src="/path/to/cdn/jquery.min.js"></script>
3 <script src="js/jquery.terminal.min.js"></script>

2. Or from a CDN.

3. Include the Mouse Wheel plugin for the mousewheel support (for legacy browsers).

1 <script src="/path/to/jquery.mousewheel-min.js"></script>

4. Include the optional polyfills for legacy browsers.

5. Include optional extensions as per your needs.

  • ascii_table.js: renders simple ascii table, like the one from mysql cli tool
  • autocomplete_menu.js: create autocomplete menu in Terminal
  • dterm.js: jQuery UI dialog extension for Terminal
  • echo_newline.js: add newlinew option for echo method inside Terminal
  • emoji.js: add support for emoji
  • less.js: create less like command in Terminal
  • pipe.js: add pipe operator and redirects to commands
  • prism.js: formatter to be used with PrismJS
  • unix_formatting.js: convert UNIX ANSI escapes to terminal and display them as html
  • xml_formatting.js: allow to use xml like syntax with colors as tags
01 <script src="js/ascii_table.js"></script>
02 <script src="js/autocomplete_menu.js"></script>
03 <script src="js/dterm.js"></script>
04 <script src="js/echo_newline.js"></script>
05 <script src="js/emoji.js"></script>
06 <script src="js/less.js"></script>
07 <script src="js/pipe.js"></script>
08 <script src="js/prism.js"></script>
09 <script src="js/unix_formatting.js"></script>
10 <script src="js/xml_formatting.js"></script>

6. Create an element for the terminal and generate a basic terminal using the following JS codes.

1 <div id="example"></div>
01 jQuery(function($, undefined) {
02   $('#example').terminal(function(command) {
03       if (command !== '') {
04           try {
05               var result = window.eval(command);
06               if (result !== undefined) {
07                   this.echo(new String(result));
08               }
09           } catch(e) {
10               this.error(new String(e));
11           }
12       } else {
13          this.echo('');
14       }
15   }, {
16      // options here
17   });
18 });

7. Config the terminal with the following options and callbacks.

001 // you can set it to string or function with one parameter which is callback that must be called with string for your prompt (you can use ajax call to get prompt from the server
002 prompt: '> ',
003  
004 // whether or not to store commands
005 history: true,
006  
007 // if this option is set to false it don't use CTRL+D to exit from terminal and don't include 'exit' command
008 exit: true,
009  
010 // whether or not to include 'clear' command
011 clear: true,
012  
013 // enable/disable terminal
014 enabled: true,
015  
016 // mask character
017 maskChar: '*',
018  
019 // if set to false terminal will not wrap long lines (it can be overwritten by echo option)
020 wrap: true,
021  
022 // if set to true it will check number of arguments in functions and in JSON-RPC if service return system.describe
023 checkArity: true,
024  
025 // it will allow to display raw html
026 raw: false,
027  
028 // tab index
029 tabindex: 1,
030  
031 // enable using terminal and cmd methods in extended commands of echo
032 invokeMethods: false,
033  
034 // executed instead of default print exception on terminal.
035 exceptionHandler: null,
036  
037 // if set to false keypress, keydown and key<a href="https://www.jqueryscript.net/tags.php?/map/">map</a> will be executed when terminal is paused
038 pauseEvents: true,
039  
040 // if set to true it will not hide command line when paused, usefull if you want to have progress animation using propmt
041 softPause: false,
042  
043 // use localStorage nor Cookies and save everything in memory only
044 memory: false,
045  
046 // cancelable AJAX requests
047 cancelableAjax: true,