"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const core_1 = require("@oclif/core");
//import { commandBase } from "../cli-common/command-base";
const inquirer = require("inquirer");
const command_base_tenantless_1 = require("../command-base-tenantless");
class Commit extends command_base_tenantless_1.CommandBaseTenantless {
    run() {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () {
                try {
                    this.bootstrap();
                    const { args, flags } = yield this.parse(Commit);
                    let message = args.message;
                    if (!message) {
                        let result = yield inquirer.prompt({ type: "input", name: "message", message: "Enter a commit message" });
                        message = result.message;
                    }
                    if (message)
                        yield this._ops.gitCommit(message);
                    resolve();
                }
                catch (err) {
                    this.handleError(err);
                    reject(err);
                }
            }));
        });
    }
}
exports.default = Commit;
Commit.description = 'Commits the currently staged changes on the current branch of the main project and on any sourced dependencies.';
Commit.flags = {
    help: core_1.Flags.help({ char: 'h' })
};
Commit.args = {
    message: core_1.Args.string({ description: 'The description to include in this particular commit.', require: false })
};
//# sourceMappingURL=commit.js.map