@jin7942/ray
Version:
Lightweight CI/CD deployment tool powered by Docker and Git
34 lines (33 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressBar = void 0;
/**
* A brutally simple and sexy classic UNIX-style progress bar.
* [######....] — no BS, no animations, just raw deployment status.
* Designed for CLI tools that mean business.
*
*/
class ProgressBar {
constructor(totalSteps) {
this.totalSteps = totalSteps;
this.current = 0;
}
/**
* Prints the progress for the current step.
* @param stepName - Description of the current step.
*/
step(stepName) {
this.current += 1;
const filled = Math.round((this.current / this.totalSteps) * 10);
const bar = '#'.repeat(filled).padEnd(10, '.');
const index = `[${String(this.current).padStart(2, '0')}/${this.totalSteps}]`;
console.log(`${index} [${bar}] ${stepName}`);
}
/**
* Called when all steps are finished.
*/
complete() {
console.log(`\nDeployment complete.`);
}
}
exports.ProgressBar = ProgressBar;