"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@oclif/core");
const _ = require("lodash");
const command_base_tenantless_1 = require("../../command-base-tenantless");
class ImagesRemove extends command_base_tenantless_1.CommandBaseTenantless {
    run() {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            this.bootstrap();
            const { args, flags } = yield this.parse(ImagesRemove);
            let imageName = args.imageName;
            if (this._projCfg.images && this._projCfg.images[imageName]) {
                if (_.unset(this._projCfg.images, imageName)) {
                    yield this.projCfgRepo.updateProjectConfigFile(this._projCfg);
                    this._ui.userMessage(`COMPLETE!  Removed image export: ${imageName}`);
                }
                else {
                    this._ui.userMessage(`Unsuccessful.  Unknown failure to delete that image.  You may need to manually remove it from the config file.`);
                }
            }
            else {
                this._ui.userMessage(`No image named [${imageName}] is configured as an export in this project.`);
                this._ui.userMessage(`No work was done.`);
            }
        });
    }
}
exports.default = ImagesRemove;
ImagesRemove.description = 'Deletes the given image export from the configuration.';
ImagesRemove.aliases = ["image:remove", "img:remove", "image:delete", "img:delete"];
ImagesRemove.flags = {
    help: core_1.Flags.help({ char: 'h' })
};
ImagesRemove.args = {
    imageName: core_1.Args.string({ required: true, description: 'image name including, scope prefix. eg:  "your-company/your-image"' })
};
//# sourceMappingURL=remove.js.map