ogit
Version:
A lazy developer's Git CLI made simple. Makes using git on cloud IDEs (i.e. C9) a walk in the park.
49 lines (48 loc) • 1.75 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 PushTagCommand extends command_1.Command {
run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { flags } = this.parse(PushTagCommand);
if (flags.all) {
yield git_1.GitFacade.pushAllTags();
}
else {
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 push',
type: 'list',
choices: listEntries,
name: 'tagName'
}
]);
yield git_1.GitFacade.pushTag(selectedTag.tagName);
}
});
}
}
PushTagCommand.description = 'Pushes local tag(s) to origin';
PushTagCommand.flags = {
// all tags: --all or -a
all: command_1.flags.string({
char: 'a',
description: 'all the local tags'
})
};
exports.default = PushTagCommand;