@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
22 lines (21 loc) • 801 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.gitConfigSet = exports.gitConfigGet = void 0;
const child_process_promise_1 = require("child-process-promise");
const argsJoin = args => args.filter(Boolean).join(" ");
async function gitConfigGet(key, {
location
} = {}) {
const {
stdout
} = await (0, child_process_promise_1.exec)(`git config --get ${argsJoin([location ? `--${location}` : undefined])} ${key}`);
return stdout.trim();
}
exports.gitConfigGet = gitConfigGet;
const gitConfigSet = (key, value, {
location,
comment
} = {}) => (0, child_process_promise_1.exec)(`git config --set ${argsJoin([location ? `--${location}` : undefined, comment ? `--comment=${comment}` : undefined])} ${key} ${value}`);
exports.gitConfigSet = gitConfigSet;