import { captureEvent } from "../common/analytics/lib.js";
import { authenticate } from "../common/middleware/authentication.js";
import { configure } from "../common/middleware/user-configuration.js";
import { identify } from "../common/middleware/user-identification.js";
import setBlocking from "../common/output.js";
import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
import { YargsChecker } from "../common/validators/lib.js";
import { link } from "../link/handler.js";
export default {
    desc: "Links information from your Zuplo account to your local machine",
    command: "link",
    builder: (yargs) => {
        return yargs
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .option("api-key", {
            type: "string",
            describe: "The API Key from Zuplo",
            envVar: "API_KEY",
        })
            .option("project", {
            type: "string",
            describe: "The project name",
        })
            .option("environment", {
            type: "string",
            describe: "The environment name",
        })
            .middleware([setBlocking, authenticate, configure, identify])
            .check(async (argv) => {
            return await new YargsChecker(new ZuploProjectValidator()).check(argv);
        });
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo link" });
        await link(argv);
    },
};
//# sourceMappingURL=link.js.map