ncp icon indicating copy to clipboard operation
ncp copied to clipboard

Filter

Open Evaske opened this issue 9 years ago • 4 comments

I think your filter script might be slightly wrong. Tested using the following REGEXP:

/package/i

Against the following /package.json. It still copies it over. After looking in to the NCP script I believe it should be the following, which works:

if (filter.test(source)) {

from line 38 of ncp.js

Unless I'm completely missing the way the filter is supposed to work?

Evaske avatar Aug 19 '15 11:08 Evaske

+1 I feel the filter is currently inversed

yangli-io avatar Sep 18 '15 06:09 yangli-io

+1 filter fails

theunexpected1 avatar Dec 02 '15 20:12 theunexpected1

Bump. Filter definitely not working. Its compounded by not having any tests or examples to look at usage. Inverting regex is very difficult / inefficient and when that is combined with the number of characters that need to be escaped on various shells, filter is not usable at command line at the moment.

cchamberlain avatar Jul 09 '16 08:07 cchamberlain

+1 copies everything, filter not working

(function() {
    'use strict';

    var ncp  = require('ncp').ncp,
        src  = './src',
        dest = './dest',
        opts = {
            filter: '([^\\s]+(\\.(?i)(pdf))$)'
        };

    ncp.limit = 50;

    ncp(src, dest, opts, function(err) {
        if(err) {
            return console.log(err);
        } else {
            return console.log('done');
        }
    });

})();

ZachMoreno avatar Jul 20 '16 21:07 ZachMoreno