Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(__CWD, __ROOT, config) {
// define program
program
.version(colors.green(config.details.version))
.description(colors.blue(config.details.description));
// register commands
return registry(program, config, commands);
};
rl.question(colors.blue("What's the path for the files, can be a single files or a list of folder? "), async (sourceDirectory: string) => {
if (!fs.existsSync(sourceDirectory)) {
console.error(`The path ${sourceDirectory} does not exists`);
rl.close();
return;
}
if (fs.lstatSync(sourceDirectory).isDirectory()) {
rl.question(colors.blue('Enter destination folder '), async (destination: string) => {
if (!fs.existsSync(destination)) {
fs.mkdirSync(destination);
console.log(colors.magenta(`Destination folder ${destination} created`))
}
const results = {};
let index = 1;
const files = fs.readdirSync(sourceDirectory);
await Promise.all(files.map(async (filename) => {
return new Promise(async (resolve) => {
console.log(colors.yellow(`Process the file ${filename}`));
const destinationPath = path.join(destination, `${filename.split('.')[0]}.json`);
if (fs.existsSync(destinationPath)) {
.on('setPosition', function(e, position) {
if (program.debug) {
console.log(colors.blue('[Conkie]'), 'Set window position', colors.red('ignored in debug mode'));
return;
}
if (program.verbose > 2) console.log(colors.blue('[Conkie]'), 'Set window position', util.inspect(position, {depth: null, colors: true}));
var mainScreen = electron.screen.getPrimaryDisplay();
var calcPosition = boxSizing(position, {
left: 10,
top: 10,
width: '33%',
height: '33%',
maxWidth: mainScreen.size.width,
maxHeight: mainScreen.size.height,
});
if (program.verbose > 3) console.log(colors.blue('[Conkie]'), 'Set window position (actual)', util.inspect(calcPosition, {depth: null, colors: true}));
if (calcPosition) {
win.setBounds({
x: calcPosition.left,
function checkTextContainsLang(text) {
const lower = text.toLowerCase(),
detectedLang = LANGS.find((lang) => lower.indexOf(lang) !== -1);
if (detectedLang) {
console.log(colors.red(`You should use the option ${colors.blue('-l')} to specify the language.`));
console.log(`example: $ how2 ${colors.blue(`-l ${detectedLang}`)} search text\n`);
}
return detectedLang;
}
cannotStar.forEach((name) => {
console.log(` - Cannot ${emoji.get('star')} ${colors.blue(name)} ${emoji.get('cry')}`)
})
function createNode(cb){
console.log(colors.blue('1. node 생성 요청'));
api.createNode(config.nodeID, cb);
},
function createRemoteCSE(nodeRI, cb){
function printDebugMsg(msg) {
if (config.debug && msg) {
console.log(colors.blue('[' + getCurrentDateTime() + ']'), colors.yellow('[DEBUG]'), msg);
}
}
function checkTextContainsLang(text) {
const lower = text.toLowerCase(),
detectedLang = LANGS.find((lang) => lower.indexOf(lang) !== -1);
if (detectedLang) {
console.log(colors.red(`You should use the option ${colors.blue('-l')} to specify the language.`));
console.log(`example: $ how2 ${colors.blue(`-l ${detectedLang}`)} search text\n`);
}
return detectedLang;
}
var conf = configuration.all()
if (!conf.taxes || !conf.taxes[country]) {
return null
}
var def = conf.taxes[country]
if (_.isNumber(def)) {
console.info(colors.blue('Tax rule for country ' + country + ' changed to scale factor ' + def))
return scale(def)
}
if (_.isString(def)) {
try {
var taxRule = customEval(def)
if (_.isFunction(taxRule)) {
console.info(colors.blue('Tax rule for country ' + country + ' changed to function ' + def))
return taxRule
} else {
console.error(colors.red('Failed to evaluate tax rule for country ' + country + ' from ' + def + ', result is not a function'))
return null
}
} catch (e) {
console.error(colors.red('Failed to evaluate tax rule for country ' + country + ' from ' + def + ', got: ' + e))
return null
}
}
return null
}
.forEach(x => {
console.log(`${colors.green('@' + x.login)}${(x.name) ? ` (${x.name})` : ''}${(x.company) ? `. Works at ${colors.blue(x.company.trimEnd())}.` : ''}
${x.url}`)
if (x.starredAt) { console.log(`Starred on: ${moment(x.starredAt).format(readableDate)}`) }
if (x.forkedAt) { console.log(`Forked on: ${moment(x.starredAt).format(readableDate)}`) }
console.log(`Public organizations:
${colors.blue('-')} ${x.organizations.map(y => `${colors.magenta(y.name)} (@${y.login}) ${y.url}`).join('\n - ')}
`)
})
if (emptyOrgs.length !== 0) {