Skip to content

Commit

Permalink
fix(themes): control fallback msg with verbose
Browse files Browse the repository at this point in the history
Closes #16
  • Loading branch information
drawnepicenter committed Jan 24, 2017
1 parent e9b8001 commit 9e3de72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bin/themes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const fs = require('fs')
const glob = require('glob')
const noon = require('noon')

const CFILE = `${process.env.HOME}/.leximaven.noon`
const config = noon.load(CFILE)

let TDIR = null
let themeDirExists = null
try {
Expand Down Expand Up @@ -35,7 +38,7 @@ exports.loadTheme = (theme) => {
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
if (!dirExists) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
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
}
Expand All @@ -55,7 +58,7 @@ exports.getThemes = () => {
} catch (e) {
if (e.code === 'ENOENT') dirExists = false
}
if (!dirExists) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
if (!dirExists && config.verbose) console.log(chalk.white(`${process.cwd()}/themes does not exist, falling back to ${process.env.NODE_PATH}/leximaven/themes.`))
files = glob.sync(`${TDIR}*.noon`)
for (let i = 0; i <= files.length - 1; i++) {
list.push(files[i].replace(/[a-z0-9/_.]*themes\//, '').replace(/\.noon/, ''))
Expand Down

0 comments on commit 9e3de72

Please sign in to comment.