From dfe1610a475c0750efc7aae42b3079df4ab69438 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 4 Oct 2018 13:30:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Move=20Slimer=20UI=20into=20Pret?= =?UTF-8?q?ty=20CLI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - We'll want these log utils in other cli tools --- ghost/pretty-cli/pretty-cli.js | 4 ++++ ghost/pretty-cli/ui.js | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 ghost/pretty-cli/ui.js diff --git a/ghost/pretty-cli/pretty-cli.js b/ghost/pretty-cli/pretty-cli.js index 92c08d7da9..7811943277 100644 --- a/ghost/pretty-cli/pretty-cli.js +++ b/ghost/pretty-cli/pretty-cli.js @@ -1,5 +1,6 @@ const Api = require('sywac/api'); const styles = require('./styles'); +const ui = require('./ui'); /** * Pretty CLI * @@ -24,3 +25,6 @@ module.exports.Api = Api; // Export the styles module.exports.styles = styles; + +// Export our ui tools +module.exports.ui = ui; diff --git a/ghost/pretty-cli/ui.js b/ghost/pretty-cli/ui.js new file mode 100644 index 0000000000..90014a225d --- /dev/null +++ b/ghost/pretty-cli/ui.js @@ -0,0 +1,15 @@ +const chalk = require('chalk'); +const log = (...args) => console.log(...args); // eslint-disable-line no-console + +module.exports.log = log; +module.exports.log.error = (...args) => { + log(chalk.red('error'), ...args); +}; + +module.exports.log.info = (...args) => { + log(chalk.cyan('info'), ...args); +}; + +module.exports.log.ok = (...args) => { + log(chalk.green('ok'), ...args); +};