"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 logger_1 = require("@pnpm/logger");
const store_path_1 = require("@pnpm/store-path");
const common_tags_1 = require("common-tags");
const path = require("path");
const createStoreController_1 = require("../../createStoreController");
const serverConnectionInfoDir_1 = require("../../serverConnectionInfoDir");
exports.default = (opts) => __awaiter(this, void 0, void 0, function* () {
    const store = yield store_path_1.default(opts.prefix, opts.store);
    const connectionInfoDir = serverConnectionInfoDir_1.default(store);
    const serverJson = yield createStoreController_1.tryLoadServerJson({
        serverJsonPath: path.join(connectionInfoDir, 'server.json'),
        shouldRetryOnNoent: false,
    });
    if (serverJson === null) {
        logger_1.default.info(`No server is running for the store at ${store}`);
        return;
    }
    console.log(common_tags_1.stripIndents `
    store: ${store}
    process id: ${serverJson.pid}
    remote prefix: ${serverJson.connectionOptions.remotePrefix}
  `);
});
//# sourceMappingURL=status.js.map