@alexbosworth/caporal
Version:
A full-featured framework for building command line applications (cli) with node.js
16 lines (13 loc) • 379 B
JavaScript
const c = require('colorette');
exports.colorize = (text) => {
return text.replace(/<([^>]+)>/gi, (match) => {
return c.blue(match);
}).replace(/<command>/gi, (match) => {
return c.magenta(match);
}).replace(/\[([^[\]]+)\]/gi, (match) => {
return c.yellow(match);
}).replace(/ --?([^\s,]+)/gi, (match) => {
return c.green(match);
});
};
;