Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.add = function add(config, hostName, hostType, hostPath, hostArgs, hostTags) {
console.log(chalk.grey(`Using config "${config.configPath}"`));
if (config.hosts[hostName]) {
console.log(chalk.red(`Host "${hostName}" already exists`));
return;
}
if (!esh.supportedHosts.includes(hostType)) {
console.log(
chalk.red(
`Host type "${hostType}" not supported. Supported host types are: "${esh.supportedHosts.join(", ")}"`
)
);
return;
}
if (hostPath && !path.isAbsolute(hostPath)) {
hostPath = path.join(process.cwd(), hostPath);
}
config.hosts[hostName] = {
type: hostType,
path: hostPath,
args: hostArgs,
exports.add = function add(config, hostName, hostType, hostPath, hostArgs, hostTags) {
console.log(chalk.grey(`Using config "${config.configPath}"`));
if (config.hosts[hostName]) {
console.log(chalk.red(`Host "${hostName}" already exists`));
return;
}
if (!esh.supportedHosts.includes(hostType)) {
console.log(
chalk.red(
`Host type "${hostType}" not supported. Supported host types are: "${esh.supportedHosts.join(", ")}"`
)
);
return;
}
if (hostPath && !path.isAbsolute(hostPath)) {
hostPath = path.join(process.cwd(), hostPath);
}
config.hosts[hostName] = {
type: hostType,
path: hostPath,
args: hostArgs,
tags: hostTags,
};
config.save();