UNPKG

ogit

Version:

A lazy developer's Git CLI made simple. Makes using git on cloud IDEs (i.e. C9) a walk in the park.

40 lines (39 loc) 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const command_1 = require("@oclif/command"); const git_1 = require("../wrapper/git"); const inquirer = require("inquirer"); const FileNameUtils_1 = require("../utils/FileNameUtils"); class default_1 extends command_1.Command { constructor() { super(...arguments); this.stashNames = []; this.choices = []; this.shouldProceedWithPrompts = () => { return true; }; } runHelper() { return tslib_1.__awaiter(this, void 0, void 0, function* () { const stashes = yield git_1.GitFacade.getStashes(); stashes.forEach(stash => { const stashDisplayName = `(${stash.stashNumber}) On ${stash.branchName} : ${stash.stashName}`; this.stashNames.push({ name: stashDisplayName, value: stash }); }); const status = yield git_1.GitFacade.status(); status.all.forEach(file => { this.choices.push({ name: `${file.path} ${FileNameUtils_1.FileNameUtils.getFileChangeType(file.changeType)}`, value: file, checked: true }); }); if (this.shouldProceedWithPrompts()) { const answers = yield inquirer.prompt(yield this.getPrompts()); yield this.performStashOperation(answers); } }); } } exports.default = default_1;