Sha256: f53e3627ce9f66c1fbfb1d869f2ed18bba03daced7778d89e5a73d0f1404aec0

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

var mout = require('mout');
var PackageRepository = require('../../core/PackageRepository');
var cli = require('../../util/cli');
var defaultConfig = require('../../config');

function list(logger, packages, options, config) {
    var repository;

    config = defaultConfig(config);
    repository = new PackageRepository(config, logger);

    // If packages is an empty array, null them
    if (packages && !packages.length) {
        packages = null;
    }

    return repository.list()
    .then(function (entries) {
        if (packages) {
            // Filter entries according to the specified packages
            entries = entries.filter(function (entry) {
                return !!mout.array.find(packages, function (pkg) {
                    return pkg === entry.pkgMeta.name;
                });
            });
        }

        return entries;
    });
}

// -------------------

list.line = function (logger, argv) {
    var options = cli.readOptions(argv);
    var packages = options.argv.remain.slice(2);
    return list(logger, packages, options);
};

list.completion = function () {
    // TODO:
};

module.exports = list;

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/lib/commands/cache/list.js