moshai-cli
Version:
A modern, fast Node.js CLI powered by arasadrahman
31 lines (25 loc) ⢠1.13 kB
JavaScript
const git = require('simple-git')();
const chalk = require('chalk').default;
module.exports = class PullCommand {
static signature = 'git:pull';
static description = 'Pull latest changes from remote';
async handle() {
try {
const result = await git.pull();
console.log(chalk.green('ā
Pulled latest changes!'));
if (result.summary.changes || result.summary.insertions || result.summary.deletions) {
console.log(chalk.blue(`š Files changed: ${result.summary.changes}`));
console.log(chalk.green(`ā Insertions: ${result.summary.insertions}`));
console.log(chalk.red(`ā Deletions: ${result.summary.deletions}`));
}
if (result.files.length > 0) {
console.log(chalk.yellow('\nš Changed files:'));
for (const file of result.files) {
console.log(` - ${file}`);
}
}
} catch (err) {
console.error(chalk.red('ā Pull failed:'), err.message);
}
}
};