MCPcopy
hub / github.com/jcubic/jquery.terminal / process_line

Function process_line

js/jquery.terminal-src.js:8619–8721  ·  view source on GitHub ↗
(line, safe_throw)

Source from the content-addressed store, hash-verified

8617 }
8618 // ---------------------------------------------------------------------
8619 function process_line(line, safe_throw) {
8620 // prevent exception in display exception
8621 try {
8622 var use_cache = !is_function(line.value);
8623 var line_settings = $.extend({
8624 exec: true,
8625 raw: false,
8626 useCache: use_cache,
8627 invokeMethods: false,
8628 formatters: true,
8629 dynamic: is_function(line.value),
8630 convertLinks: settings.convertLinks
8631 }, line.options || {});
8632 var string = stringify_value(line.value);
8633 if (string && is_function(string.then)) {
8634 // handle function that return a promise #629
8635 return string.then(function(string) {
8636 process_line($.extend(line, {
8637 value: string,
8638 options: line_settings
8639 }));
8640 });
8641 }
8642 if (string !== '') {
8643 if (!line_settings.raw) {
8644 if (settings.useCache && line_settings.useCache) {
8645 var key = string;
8646 if (line_cache && line_cache.has(key)) {
8647 var data = line_cache.get(key);
8648 buffer.append(
8649 data.input,
8650 line.index,
8651 line_settings,
8652 data.raw
8653 );
8654 return true;
8655 }
8656 }
8657 if (line_settings.formatters) {
8658 try {
8659 string = $.terminal.apply_formatters(
8660 string,
8661 $.extend(settings, {echo: true})
8662 );
8663 } catch (e) {
8664 display_exception(e, 'FORMATTING');
8665 }
8666 }
8667 string = process_extended_commands(string, line, line_settings);
8668 if (string === '') {
8669 return;
8670 }
8671 if (line_settings.convertLinks) {
8672 string = links(string);
8673 }
8674 var raw_string = string;
8675 string = crlf($.terminal.normalize(string));
8676 string = $.terminal.encode(string, {

Callers 2

echoFunction · 0.70

Calls 15

apply_formattersMethod · 0.80
normalizeMethod · 0.80
encodeMethod · 0.80
colsMethod · 0.80
split_equalMethod · 0.80
is_functionFunction · 0.70
stringify_valueFunction · 0.70
display_exceptionFunction · 0.70
linksFunction · 0.70
crlfFunction · 0.70
should_wrapFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…