Skip to content

fix(touch): enhance parseOptions and fix touch's -r flag#341

Merged
ariporad merged 1 commit intomasterfrom
feat-valued-options
Feb 5, 2016
Merged

fix(touch): enhance parseOptions and fix touch's -r flag#341
ariporad merged 1 commit intomasterfrom
feat-valued-options

Conversation

@nfischer
Copy link
Copy Markdown
Member

@nfischer nfischer commented Feb 4, 2016

This improves parseOptions to allow options of the form:

touch({'-r', 'path/to/file'}, 'other-file.txt');

to supply a value to an option. In this example, -r has the string value 'path/to/file'.

@nfischer nfischer added fix Bug/defect, or a fix for such a problem high priority labels Feb 4, 2016
@nfischer nfischer added this to the v0.6.0 milestone Feb 4, 2016
src/common.js Outdated
var optionName;
if (typeof opt === 'string') {
// e.g. match[1] = 'Rf' for opt = '-Rf'
var match = opt.match(/^\-(.+)/);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would be much more performant if it just was opt[0] === '-'.

@ariporad
Copy link
Copy Markdown
Contributor

ariporad commented Feb 4, 2016

One small nit, otherwise looks good!

@ariporad
Copy link
Copy Markdown
Contributor

ariporad commented Feb 4, 2016

@nfischer: In the changelog, how should this be described?

@nfischer nfischer force-pushed the feat-valued-options branch from 5434a0e to dc79d7e Compare February 4, 2016 23:42
@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Feb 4, 2016

@ariporad I replaced the instances of match() with suitable alternatives

@ariporad
Copy link
Copy Markdown
Contributor

ariporad commented Feb 4, 2016

@nfischer: Fantastic!

@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Feb 4, 2016

In the changelog, you can just say something like "feat: now supports valued options (see touch -r for an example)."

@ariporad
Copy link
Copy Markdown
Contributor

ariporad commented Feb 4, 2016

Will Do!

@ariporad
Copy link
Copy Markdown
Contributor

ariporad commented Feb 5, 2016

LGTM!

ariporad added a commit that referenced this pull request Feb 5, 2016
fix(touch): enhance parseOptions and fix touch's -r flag
@ariporad ariporad merged commit f9c8fc0 into master Feb 5, 2016
@ariporad ariporad deleted the feat-valued-options branch February 5, 2016 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug/defect, or a fix for such a problem high priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants