@puls-atlas/cli
Version:
The Puls Atlas CLI tool for managing Atlas projects
28 lines • 692 B
JavaScript
import execSync from './execSync.js';
const hasLocalChanges = () => {
const changes = execSync('git status', {
porcelain: true,
stdio: 'pipe'
}).toString();
return changes.length > 0;
};
const diff = (v1, v2, options = {}) => {
let cmd = `git diff ${v1} ${v2} --word-diff=porcelain`;
if (options.path) {
cmd += ` -- ${options.path}`;
}
return execSync(cmd, {
stdio: 'pipe'
}).toString();
};
const getCurrentBranch = () => execSync('git branch', {
showCurrent: true,
stdio: 'pipe'
}).toString().trim();
const isOnBranch = (...branches) => branches.includes(getCurrentBranch());
export default {
hasLocalChanges,
isOnBranch,
getCurrentBranch,
diff
};