Skip to content

Commit

Permalink
Set default parameters in init and config CLI commands
Browse files Browse the repository at this point in the history
  • Loading branch information
UltCombo committed Dec 10, 2014
1 parent 7979276 commit 80bab63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/bin/cli/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 4 additions & 5 deletions src/bin/cli/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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(
Expand Down

1 comment on commit 80bab63

@UltCombo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBR=@jaydson

Please sign in to comment.