forked from calvinmetcalf/copyfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyfiles
executable file
·27 lines (27 loc) · 857 Bytes
/
copyfiles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env node
'use strict';
var copyfiles = require('./index');
var pkg = require('./package.json');
var program = require('ltcdr');
program.version(pkg.version)
.option('-u, --up [levels]', 'slice a path off the bottom of the paths', parseInt)
.option('-a --all', 'include files and directories whose names begin with a dot (.)')
.option('-f, --flat', 'flatten the output')
.option('-e, --exclude [pattern]', 'pattern or glob to exclude', list)
.option('-s, --soft', 'do not overwrite destination files if they exist')
.usage('[options] inFile [more files ...] outDirectory')
.parse(process.argv);
if (program.flat) {
program.up = true;
}
copyfiles(program.args, program, function (err) {
if (err) {
console.error(err);
process.exit(1);
} else {
process.exit(0);
}
});
function list(val) {
return val.split(',');
}