Skip to content

Conversation

@RyanZim
Copy link
Contributor

@RyanZim RyanZim commented Feb 26, 2017

Fixes #15.

@RyanZim RyanZim mentioned this pull request Feb 26, 2017
@coveralls
Copy link

coveralls commented Feb 26, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 2f92c2b on RyanZim:config into 849c1b6 on adamreisnz:master.

Copy link
Owner

@adamreisnz adamreisnz left a comment

Choose a reason for hiding this comment

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

Hey @RyanZim, thanks for the PR. I'll have a closer look at it when I'm back from my trip next week.

With this approach, having a config file means you can't pass CLI arguments to "override" the config file if you will, or to only use the config file for common parameters while feeding from and/or to parameters via the CLI. I'd like to support this though, as it seems like a logical use case. Could you see if you can add that in? Otherwise I can take it from here when I'm back.

@RyanZim
Copy link
Contributor Author

RyanZim commented Mar 2, 2017

@adamreisnz Updated. Hope this is what you wanted, let me know if I misunderstood.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c7919f0 on RyanZim:config into 849c1b6 on adamreisnz:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c7919f0 on RyanZim:config into 849c1b6 on adamreisnz:master.

@coveralls
Copy link

coveralls commented Mar 2, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling c7919f0 on RyanZim:config into 849c1b6 on adamreisnz:master.

@adamreisnz
Copy link
Owner

I think so, will test this on Monday when back from holiday.

Copy link
Owner

@adamreisnz adamreisnz left a comment

Choose a reason for hiding this comment

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

A few small changes, rest looks good! Thanks!

bin/cli.js Outdated
const to = argv._.shift();
let from;
let to;
let files;
Copy link
Owner

Choose a reason for hiding this comment

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

Can we simplify this to a one liner let from, to, files;?

config = require(path.join(process.cwd(), argv.config));
}
catch (e) {
console.error(chalk.red('Cannot load config file'));
Copy link
Owner

Choose a reason for hiding this comment

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

Probably need to add a console.error(chalk.red(e)); to notify the user of the error

bin/cli.js Outdated
}
from = config.from;
to = config.to;
if (typeof config.files === 'string') config.files = [config.files];
Copy link
Owner

Choose a reason for hiding this comment

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

This won't pass the linter, need to wrap if statements with curly brackets

bin/cli.js Outdated

if (!from) from = argv._.shift();
if (!to) to = argv._.shift();
if (!files) files = argv._;
Copy link
Owner

Choose a reason for hiding this comment

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

Same here, needs curly brackets for the if statements. In addition, the checks need to explicitly check for undefined, otherwise you won't be able to replace with an empty string. E.g. if (typeof to === 'undefined')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Didn't think about undefined.

bin/cli.js Outdated
if (!to) to = argv._.shift();
if (!files) files = argv._;

if (!from || !to) {
Copy link
Owner

Choose a reason for hiding this comment

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

Also needs undefined checks

@RyanZim
Copy link
Contributor Author

RyanZim commented Mar 4, 2017

Updated.

@coveralls
Copy link

coveralls commented Mar 4, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 19de14e on RyanZim:config into acf5fc7 on adamreisnz:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 19de14e on RyanZim:config into acf5fc7 on adamreisnz:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 19de14e on RyanZim:config into acf5fc7 on adamreisnz:master.

@adamreisnz adamreisnz merged commit 3a3ca2c into adamreisnz:master Mar 7, 2017
@RyanZim RyanZim deleted the config branch March 7, 2017 13:51
@RyanZim
Copy link
Contributor Author

RyanZim commented Mar 7, 2017

Thanks @adamreisnz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants