Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.handler = (argv) => {
const key = argv.key
let value = null
tools.checkConfig(CFILE)
const config = noon.load(CFILE)
const theme = themes.loadTheme(config.theme)
if (config.verbose) themes.label(theme, 'down', 'Configuration')
if (dot.has(config, key)) {
value = /\./i.test(key) ? dot.get(config, key) : config[key]
} else {
throw new Error(`Option ${key} not found.`)
}
console.log(`Option ${chalk.white.bold(key)} is ${chalk.white.bold(value)}.`)
}
exports.handler = (argv) => {
const key = argv.key
let value = null
tools.checkConfig(CFILE)
const config = noon.load(CFILE)
const theme = themes.loadTheme(config.theme)
if (config.verbose) themes.label(theme, 'down', 'Configuration')
if (dot.has(config, key)) {
value = /\./i.test(key) ? dot.get(config, key) : config[key]
} else {
throw new Error(`Option ${key} not found.`)
}
console.log(`Option ${chalk.white.bold(key)} is ${chalk.white.bold(value)}.`)
}
exports.loadTheme = (theme) => {
let dirExists = null
let load = null
try {
fs.statSync('themes')
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
const CFILE = `${process.env.HOME}/.iloa.noon`
const config = noon.load(CFILE)
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/iloa/themes.`))
load = noon.load(`${TDIR}${theme}.noon`)
return load
}
exports.loadTheme = (theme) => {
let dirExists = null
let load = null
try {
fs.statSync('themes')
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
const CFILE = `${process.env.HOME}/.leximaven.noon`
const config = noon.load(CFILE)
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
load = noon.load(`${TDIR}${theme}.noon`)
return load
}
*/exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.iloa.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/iloa/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
* Gets themes for list command
*/exports.loadTheme=function(theme){var dirExists=null;var load=null;try{fs.statSync('themes');dirExists=true;}catch(e){if(e.code==='ENOENT')dirExists=false;}var CFILE=process.env.HOME+'/.leximaven.noon';var config=noon.load(CFILE);if(!dirExists&&config.verbose)console.log(chalk.white(process.cwd()+'/themes does not exist, falling back to '+process.env.NODE_PATH+'/leximaven/themes.'));load=noon.load(''+TDIR+theme+'.noon');return load;};/**
* Gets themes for list command
exports.loadTheme = (theme) => {
let dirExists = null
let load = null
try {
fs.statSync('themes')
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
const CFILE = `${process.env.HOME}/.iloa.noon`
const config = noon.load(CFILE)
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/iloa/themes.`))
load = noon.load(`${TDIR}${theme}.noon`)
return load
}
obj.dmuse.date.stamp = new Date().toJSON()
obj.onelook.date.stamp = new Date().toJSON()
obj.rbrain.date.stamp = new Date().toJSON()
obj.wordnik.date.stamp = new Date().toJSON()
let fileExists = null
try {
fs.statSync(CFILE)
fileExists = true
} catch (e) {
if (e.code === 'ENOENT') {
fileExists = false
}
}
if (fileExists) {
if (argv.f) {
const config = noon.load(CFILE)
obj.dmuse.date.stamp = config.dmuse.date.stamp
obj.dmuse.date.remain = config.dmuse.date.remain
obj.onelook.date.stamp = config.onelook.date.stamp
obj.onelook.date.remain = config.onelook.date.remain
obj.rbrain.date.stamp = config.rbrain.date.stamp
obj.rbrain.date.remain = config.rbrain.date.remain
obj.wordnik.date.stamp = config.wordnik.date.stamp
obj.wordnik.date.remain = config.wordnik.date.remain
noon.save(CFILE, obj)
console.log(`Overwrote ${chalk.white.bold(CFILE)}.`)
} else {
console.log(`Using configuration at ${chalk.white.bold(CFILE)}.`)
}
} else if (!fileExists) {
noon.save(CFILE, obj)
console.log(`Created ${chalk.white.bold(CFILE)}.`)
exports.handler = (argv) => {
let obj = null
let configExists = null
let dirExists = null
try {
fs.statSync('default.config.noon')
configExists = true
} catch (e) {
if (e.code === 'ENOENT') configExists = false
}
if (configExists) {
obj = noon.load('default.config.noon')
} else {
try {
fs.statSync(PKGDIR)
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') {
dirExists = false
}
}
if (dirExists) {
obj = noon.load(`${PKGDIR}default.config.noon`)
} else {
throw new Error('Package dir not found, set NODE_PATH per documentation.')
}
}
obj.dmuse.date.stamp = new Date().toJSON()
exports.handler = (argv) => {
let obj = null
let configExists = null
let dirExists = null
try {
fs.statSync('default.config.noon')
configExists = true
} catch (e) {
if (e.code === 'ENOENT') configExists = false
}
if (configExists) {
obj = noon.load('default.config.noon')
} else {
try {
fs.statSync(PKGDIR)
dirExists = true
} catch (e) {
if (e.code === 'ENOENT') {
dirExists = false
}
}
if (dirExists) {
obj = noon.load(`${PKGDIR}default.config.noon`)
} else {
throw new Error('Package dir not found, set NODE_PATH per documentation.')
}
}
obj.wolf.date.stamp = new Date().toJSON()