From 02b4a22f884db63d8751db3493e5554bd233d045 Mon Sep 17 00:00:00 2001 From: Vikas Potluri Date: Mon, 18 Jan 2021 13:24:57 -0600 Subject: [PATCH] feat(config): remind user to restart ghost after making changes --- lib/commands/config.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/commands/config.js b/lib/commands/config.js index 42cc1f770..62bc66f9d 100644 --- a/lib/commands/config.js +++ b/lib/commands/config.js @@ -37,6 +37,19 @@ class ConfigCommand extends Command { // setter this.instance.config.set(key, value).save(); this.ui.log(`Successfully set '${key}' to '${value}'`, 'green'); + + // If the instance is running, we want to remind the user to restart + // it so the new config can take effect. The isRunning check is only + // a nicety, so if it fails, swallow the error for better UX. + try { + if (await this.instance.isRunning()) { + const chalk = require('chalk'); + this.ui.log( + `Ghost is running. Don't forget to run ${chalk.cyan('ghost restart')} to reload the config!` + ); + } + } catch (_) {} // eslint-disable-line no-empty + return; }