30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.parseGetRemotesVerbose = exports.parseGetRemotes = void 0;
|
|
const utils_1 = require("../utils");
|
|
function parseGetRemotes(text) {
|
|
const remotes = {};
|
|
forEach(text, ([name]) => remotes[name] = { name });
|
|
return Object.values(remotes);
|
|
}
|
|
exports.parseGetRemotes = parseGetRemotes;
|
|
function parseGetRemotesVerbose(text) {
|
|
const remotes = {};
|
|
forEach(text, ([name, url, purpose]) => {
|
|
if (!remotes.hasOwnProperty(name)) {
|
|
remotes[name] = {
|
|
name: name,
|
|
refs: { fetch: '', push: '' },
|
|
};
|
|
}
|
|
if (purpose && url) {
|
|
remotes[name].refs[purpose.replace(/[^a-z]/g, '')] = url;
|
|
}
|
|
});
|
|
return Object.values(remotes);
|
|
}
|
|
exports.parseGetRemotesVerbose = parseGetRemotesVerbose;
|
|
function forEach(text, handler) {
|
|
utils_1.forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
|
|
}
|
|
//# sourceMappingURL=GetRemoteSummary.js.map
|