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 { create } from "../../variable/create/handler.js";
import { fetchAccount } from "../../common/middleware/get-account-param.js";
import { fetchProject } from "../../common/middleware/get-project-param.js";
export default {
    desc: "Creates a new variable for a branch",
    command: "create",
    builder: (yargs) => {
        return yargs
            .option("name", {
            type: "string",
            describe: "The name of the variable to create",
        })
            .option("value", {
            type: "string",
            describe: "The value of the variable to create",
        })
            .option("is-secret", {
            type: "boolean",
            describe: "Is the variable a secret",
        })
            .option("branch", {
            type: "string",
            describe: "The branch where the variable should be set",
        })
            .option("api-key", {
            type: "string",
            describe: "The API Key from Zuplo",
            envVar: "API_KEY",
        })
            .option("account", {
            type: "string",
            describe: "The account name",
        })
            .option("project", {
            type: "string",
            describe: "The project name",
        })
            .demandOption(["name", "value", "is-secret", "branch"])
            .middleware([
            setBlocking,
            authenticate,
            configure,
            fetchAccount,
            fetchProject,
            identify,
        ]);
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo variable create" });
        await create(argv);
    },
};
//# sourceMappingURL=create.js.map