ogit
Version:
A lazy developer's Git CLI made simple. Makes using git on cloud IDEs (i.e. C9) a walk in the park.
45 lines (44 loc) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
require("reflect-metadata");
const git_1 = require("../wrapper/git");
const command_1 = require("@oclif/command");
const inquirer = require("inquirer");
class DeleteTagCommand extends command_1.Command {
run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const localTags = yield git_1.GitFacade.tags();
const listEntries = [
{ name: `${localTags.latest} (latest)`, value: localTags.latest }
];
if (localTags.all) {
localTags.all.reverse().forEach(tagValue => {
if (tagValue !== localTags.latest) {
listEntries.push({ name: tagValue, value: tagValue });
}
});
}
const selectedTag = yield inquirer.prompt([
{
message: 'Select the tag to delete',
type: 'list',
choices: listEntries,
name: 'tagName'
},
{
message: 'Would you like to delete the tag to origin?',
type: 'confirm',
name: 'immediatePush',
default: false
}
]);
yield git_1.GitFacade.deleteLocalTag(selectedTag.tagName);
if (selectedTag.immediatePush) {
yield git_1.GitFacade.deleteRemoteTag(selectedTag.tagName);
}
});
}
}
DeleteTagCommand.description = 'Deletes a tag from local and remote repo';
exports.default = DeleteTagCommand;