"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const pnpm_list_1 = require("pnpm-list");
function default_1(args, opts, command) {
    return __awaiter(this, void 0, void 0, function* () {
        opts.long = opts.long || command === 'll' || command === 'la';
        const only = (opts.production && opts.development ? undefined : (opts.production ? 'prod' : 'dev')); // tslint:disable-line:no-unnecessary-type-assertion
        const listOpts = {
            alwaysPrintRootPackage: opts.alwaysPrintRootPackage,
            depth: opts.depth || 0,
            long: opts.long,
            only,
            parseable: opts.parseable,
            shrinkwrapDirectory: opts.shrinkwrapDirectory,
        };
        const output = args.length
            ? yield pnpm_list_1.forPackages(args, opts.prefix, listOpts)
            : yield pnpm_list_1.default(opts.prefix, listOpts);
        if (output)
            console.log(output);
    });
}
exports.default = default_1;
//# sourceMappingURL=list.js.map