Skip to content

Commit

Permalink
[#53] Format output text
Browse files Browse the repository at this point in the history
  • Loading branch information
jfacorro committed Jun 3, 2018
1 parent 6348d69 commit c9816c1
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions priv/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@ var init = function() {
self._term.error(message);
};


self.print = function(json) {
if(json.message) self._term.echo(json.message);
self.echo(json.message, 'stdout');
self._term.set_prompt(json.prompt);
self.clientCount(json.client_count);

if(json.result) self._term.echo(json.result);
if(json.stdout) self._term.echo(json.stdout);
if(json.stderr) self._term.error(json.stderr);
self.echo(json.result, 'result');
self.echo(json.stdout, 'stdout');
self.echo(json.stderr, 'stderr');
};

self.echo = function(msg, cssClass) {
if(msg) {
msg = $.terminal.escape_brackets(msg);
msg = '[[;;;' + cssClass + ']' + msg + ']';
self._term.echo(msg);
}
};

self._conn.onopen = function(message) {
Expand Down

0 comments on commit c9816c1

Please sign in to comment.