jcubic/jquery.terminal — pull request #27 by AlexNisnevich (2012-04-03 21:43:08+00:00)
Title: Adding three new settings to the terminal

Adding three new settings to the terminal:

validator [function(cmd)]: boolean function to be called after a command is entered
onValidatorFail [function(cmd)]: function to be called if the validator call result is false
historycolors [object]: object with two properties: 'prompt' and 'command'. If this object exists, prompts and commands in the history will be colored according to these colors, respectively.

For examples of how to use these settings, see https://github.com/AlexNisnevich/ECMAchine , where I use the following settings:

```
validator: function(command) {
return (command.split('(').length <= command.split(')').length);
},
onValidatorFail: function(command) {
terminal.set_command(command + '\n.. ');
},
historycolors: {
'prompt': '#080',
'command': '#399'
}
```

In this case, the validator is used to insert a new line and '.. ' string after an incomplete command (to allow multi-line commands), while historycolors is used to persist the colors of the prompt and the command.