wv-gotcha
Version:
 wv-local-service-bus # Purpose To accumulate your walkthroughs to accomplish your common tasks with less effort.
38 lines • 1.87 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Git = void 0;
const temp_circuits_1 = require("temp-circuits");
const Shell_1 = require("../../Shell");
class Git {
static getRemoteOriginAsync() {
return __awaiter(this, void 0, void 0, function* () {
const result = yield Shell_1.Shell.RunForStdout("git remote -v");
const matches = temp_circuits_1.Regex.of(/\s/g).splitByMatches(result);
if (matches.length < 2) {
Shell_1.Shell.error("No remote configuration found");
process.exit(0);
}
return matches[1].value;
});
}
static getBranchNames() {
const result = Shell_1.Shell.RunForStdout("git branch");
const names = temp_circuits_1.Regex.of(/\n/g).splitByMatches(result).map(b => b.value).filter(name => !!name).map(name => name.replace("*", "").trim().toLowerCase());
return names;
}
static getCurrentBranch() {
const currentBranch = Shell_1.Shell.RunForStdout("git symbolic-ref --short HEAD").trim();
return currentBranch;
}
}
exports.Git = Git;
//# sourceMappingURL=Git.js.map