Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (__sender__ === this.senderId) {
// Do not write to the terminal console if the sender is the widget itself
return;
}
if (!this.terminal) {
return;
}
data = String(data).trim();
if (source) {
this.terminal.writeln(color.blackBright(source) + color.white(this.terminal.prompt + data));
} else {
this.terminal.writeln(color.white(this.terminal.prompt + data));
}
},
'serialport:read': (data) => {
if (name.length > 1 && name !== 'config' && name !== 'version' && name !== 'help') {
options[camelCase(name)] = value;
}
});
if (!options.parsers) options.parsers = {};
if (!options.transforms) options.transforms = [];
// clean up options.output
if (options.output == null) options.output = true;
// # help konsole
var help = new Konsole('log');
var logo = 'QuickStart ' + clc.white('v' + manifest.version);
help.group(logo);
help.write('');
help.write(clc.green('--self '),
'compile quickstart for browser compilation. defaults to', clc.red('false'));
help.write(clc.green('--root '),
'use this as the root of each path. defaults to', clc.blue(pathogen.cwd()));
help.write(clc.green('--main '),
'override the default entry point. defaults to', clc.red('false'));
help.write(clc.green('--output, -o '),
'output the compiled source to a file or STDOUT. defaults to', clc.blue('STDOUT'));
return;
}
// Non-printable keys (e.g. ctrl-x)
if (nonPrintableKey) {
onData(key);
return;
}
// Make sure the cursor position will not exceed the number of columns
if (term.buffer.x < term.cols) {
let x = line.length - 1;
for (; x > term.buffer.x; --x) {
line[x] = line[x - 1];
}
term.write(color.white(key));
}
};
})(),
}
return;
}
// ArrowUp
if (event.key === 'ArrowUp') {
if (!historyCommand) {
historyCommand = this.history.current() || '';
} else if (this.history.index > 0) {
historyCommand = this.history.back() || '';
}
term.eraseLine(term.buffer.y);
term.buffer.x = 0;
term.write(color.white(this.prompt));
term.write(color.white(historyCommand));
return;
}
// ArrowDown
if (event.key === 'ArrowDown') {
historyCommand = this.history.forward() || '';
term.eraseLine(term.buffer.y);
term.buffer.x = 0;
term.write(color.white(this.prompt));
term.write(color.white(historyCommand));
return;
}
// PageUp
if (event.key === 'PageUp') {
// Unsupported
exports.subcommandSuggestion = function(program, subcommand){
var commands = _.map(program.commands, '_name'),
requestedCommand = _.head(program.args);
if(program.args.length && !_.includes(commands, requestedCommand)){
var prefix = ['alks', subcommand, ''].join(' '),
msg = [prefix, requestedCommand, ' is not a valid ALKS command.'],
suggests = fuzzy.filter(requestedCommand, commands),
suggest = suggests.map(function(sug){ return sug.string; });
if(suggest.length){
msg.push(clc.white(' Did you mean '));
msg.push(clc.white.underline(prefix + suggest[0]));
msg.push(clc.white('?'));
}
exports.errorAndExit(msg.join(''));
}
};
Utils.prototype.formatTunnel = function(name, tunnel) {
return C.cyan(name) + ': ' + C.white('source port') + ' = ' + C.bold(tunnel.sourcePort) + ", " + C.white('host') + ' = ' + C.bold(tunnel.host) + ', ' + C.white('dest port') + ' = ' + C.bold(tunnel.destPort);
};
cl_white: s => clicolor.white(s),
cl_magenta: s => clicolor.magenta(s),
result.tunnelsToCreate.push({
sourcePort: tunnelArr[0],
host: tunnelArr[1],
destPort: tunnelArr[2],
name: name
});
}
});
return result;
}
if (opts.file && fs.existsSync(opts.file)) {
var result = configManager.readTunnelFile(opts.file);
if (!result.success) {
output = [C.red(result.msg)];
output.push(C.white(result.error.message));
output.push('\nPlease have a look at the included sample file ssh-tunnels.yml.sample!');
return Q.reject(output.join('\n'));
} else {
output.push('Config file ' + C.green(opts.file) + ' found, setting up tunnels from this file');
if (result.data && Object.keys(result.data).length) {
var ret = parseTunnelData(result.data);
tunnelsToCreate = tunnelsToCreate.concat(ret.tunnelsToCreate);
missingVariables = missingVariables.concat(ret.misingVars);
}
}
}
if (opts.group && opts.group.length) {
opts.group.forEach(function(group) {
if (group && group.indexOf(',') === -1) {
var ret = parseTunnelData(config.rawTunnelConfig[group]);
tunnelsToCreate = tunnelsToCreate.concat(ret.tunnelsToCreate);
rule.declarations.forEach(function (declaration) {
var decStr = cliColor.blueBright(cliColor.white(declaration.property) + cliColor.magenta(': ') + cliColor.redBright(declaration.value));
declaration = new RegExp(declaration.property + '([\s\S]+)?:([\s\S]+)?' + declaration.value, 'i');
cssResult += ' ' + decStr + cliColor.magenta(';\n');
});
cssResult += '}';
server.on('listening', function () {
activeTunnels[name] = {
name: name,
active: false,
server: server,
localPort: localPort,
remoteAddr: remoteAddr,
remotePort: remotePort,
tunnelString: localPort + ':' + remoteAddr + ':' + remotePort
};
app.tunnelLog(activeTunnels[name], 'connection', 'Created new tunnel from port ' + C.white(localPort) + ' to ' + C.white(remoteAddr) + ':' + C.white(remotePort));
defer.resolve(activeTunnels[name]);
});