"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, /**
 * nvu setup
 *
 * Install/reinstall nvu binaries to ~/.nvu/bin
 */ "default", {
    enumerable: true,
    get: function() {
        return setupCmd;
    }
});
var _exitcompat = /*#__PURE__*/ _interop_require_default(require("exit-compat"));
var _module = /*#__PURE__*/ _interop_require_default(require("module"));
var _path = /*#__PURE__*/ _interop_require_default(require("path"));
var _constantsts = require("../constants.js");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
var _require = typeof require === 'undefined' ? _module.default.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
var _require1 = _require('../assets/installBinaries.cjs'), installBinaries = _require1.installBinaries, printInstructions = _require1.printInstructions, syncAllShims = _require1.syncAllShims;
function setupCmd(_args) {
    installBinaries({}, function(err, installed) {
        if (err) {
            console.error("Setup failed: ".concat(err.message || err));
            (0, _exitcompat.default)(1);
            return;
        }
        // Sync all shims to the new binary
        var binDir = _path.default.join(_constantsts.storagePath, 'bin');
        syncAllShims(binDir);
        printInstructions();
        if (!installed) console.log('Use --force to reinstall binaries.');
        (0, _exitcompat.default)(0);
    });
}
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }