UNPKG

690 BJavaScriptView Raw
1#!/usr/bin/env node
2'use strict';
3
4const flowCopy = require('..');
5
6const argv = require('yargs')
7 .usage('Usage: $0 [-v|--verbose] [-w|--watch] [-i PATTERN]... SRC... DEST')
8 .boolean('verbose')
9 .boolean('watch')
10 .alias('v', 'verbose')
11 .describe('v', 'Show changes')
12 .alias('w', 'watch')
13 .describe('w', 'Re-copy files on change')
14 .alias('i', 'ignore')
15 .describe('i', 'ignore pattern (glob expression)')
16 .demandCommand(2)
17 .strict()
18 .argv;
19
20const srcs = argv._.slice(0, -1);
21const dest = argv._[argv._.length-1];
22
23flowCopy(srcs, dest, {verbose: argv.verbose, ignore: argv.ignore, watch: argv.watch})
24 .catch(err => {
25 console.error(err);
26 process.exit(1);
27 });