davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

CLI options? #26

Closed screendriver closed 8 years ago

screendriver commented 8 years ago

It is possible to pass the API options as arguments to the CLI interface? E.g. cpr --overwrite foo bar

davglass commented 8 years ago

We didn't add many options as I didn't want to add the weight of an options parser to every install of cpr. I'm not opposed to it, I just don't want the added dependency on every install.

screendriver commented 8 years ago

You could add yargs. But if you don't want add dependencies it's ok for me. Then I have to look for another Node CLI tool for directory copies. Maybe I write one by myself.

Thank you for the quick response.

davglass commented 8 years ago

No reason to write a new one, you can just wrap cpr in a custom CLI. It has all the options and it works ;)

screendriver commented 8 years ago

Hmm that's true :smile:

stevenvachon commented 8 years ago

I think that it's still necessary for npm scripts. I'd like to overwrite when I copy. I don't understand the concern with dependencies when mkdirp already uses minimist.

screendriver commented 8 years ago

I created a copy CLI tool by myself for that :wink:

stevenvachon commented 8 years ago

@screendriver that has no overwrite option. It has clobber, but I think that overwrites the entire directory and not just any files within.

Edit: Hmm, https://github.com/jprichardson/node-fs-extra/blob/0.30.0/lib/copy/ncp.js#L87-L90

Nothing against your library, but having to write your own separate library to accomplish something that a more mature, actively developed library can do is redundant.

screendriver commented 8 years ago

Yes it's a little redundant. But what should I do? I needed a cross platform CLI tool that copies and override everything (and follows symbolic links) for our continuous integration system in my company. Unfortunately your CLI can't do that and you don't want to add an option for that. So the only solution was to build my own micro tool that does that job.

stevenvachon commented 8 years ago

@screendriver the other option is to convince this library's author to implement its options in the CLI.

stevenvachon commented 8 years ago

@davglass why not implement access to the options? As mentioned above, mkdirp already depends on minimist, so we could easily do the same.

davglass commented 8 years ago

@stevenvachon I originally didn't add a CLI option, it was contributed as a PR a few months ago. I wouldn't object to a full CLI to come in another PR ;)

davglass commented 8 years ago

@screendriver I just published v2.0.0 with the PR from @stevenvachon that adds CLI options.