diff --git a/src/bin/cli/program.js b/src/bin/cli/program.js index 8ce7f1e..fef9826 100644 --- a/src/bin/cli/program.js +++ b/src/bin/cli/program.js @@ -10,19 +10,21 @@ program .version(version); program - .command('init') + .command('init [path]') .description('Init your static website') - .action((path) => { + // [BUG] https://github.com/jshint/jshint/issues/1849 - can't use arrow function + .action(function(path = '.') { console.log(logo); - init(typeof path === 'string' ? path : './'); + init(path); }); program - .command('config') + .command('config [path]') .description('Config your static website') - .action(() => { + // [BUG] https://github.com/jshint/jshint/issues/1849 - can't use arrow function + .action(function(path = '.') { console.log(logo); - config(); + config(path); }); program @@ -50,7 +52,8 @@ program program .command('run [port]') .description('Run you static site locally. Port is optional') - .action(function(port = 9356) { // We're not using arrow function here due to an jshint issue + // [BUG] https://github.com/jshint/jshint/issues/1849 - can't use arrow function + .action(function(port = 9356) { let core = require('../core'), build = core.init(); if (build) { diff --git a/src/bin/cli/util.js b/src/bin/cli/util.js index 6705185..f465f8b 100644 --- a/src/bin/cli/util.js +++ b/src/bin/cli/util.js @@ -15,9 +15,8 @@ export { init, config, newFile, run }; // Temporary // jscs:disable requireCamelCaseOrUpperCaseIdentifiers -function init(p) { - var sitePath = p, - skeletonPath = path.normalize(rootdir + '/bin/skeleton'), +function init(sitePath) { + var skeletonPath = path.normalize(rootdir + '/bin/skeleton'), copySkeleton = () => { return new Promise((resolve, reject) => { ncp(skeletonPath, sitePath, (err) => { @@ -42,9 +41,9 @@ function init(p) { }); } -function config(p) { +function config(sitePath) { var clc = cliColor(), - manifest = p ? p + '/harmonic.json' : './harmonic.json'; + manifest = sitePath + '/harmonic.json'; co(function*() { console.log(clc.message(